Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
tb-filelink-seafile
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Popi
tb-filelink-seafile
Commits
2b949b2e
Commit
2b949b2e
authored
Dec 13, 2014
by
toma
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add build script
parent
35e066c8
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
158 additions
and
0 deletions
+158
-0
.gitignore
.gitignore
+1
-0
build.sh
build.sh
+145
-0
config_build.sh
config_build.sh
+12
-0
No files found.
.gitignore
View file @
2b949b2e
.DS_Store
*.xpi
build.sh
0 → 100755
View file @
2b949b2e
#!/bin/bash
# build.sh -- builds JAR and XPI files for mozilla extensions
# by Nickolay Ponomarev <asqueella@gmail.com>
# (original version based on Nathan Yergler's build script)
# Most recent version is at <http://kb.mozillazine.org/Bash_build_script>
# This script assumes the following directory structure:
# ./
# chrome.manifest (optional - for newer extensions)
# install.rdf
# (other files listed in $ROOT_FILES)
#
# content/ |
# locale/ |} these can be named arbitrary and listed in $CHROME_PROVIDERS
# skin/ |
#
# defaults/ |
# components/ |} these must be listed in $ROOT_DIRS in order to be packaged
# ... |
#
# It uses a temporary directory ./build when building; don't use that!
# Script's output is:
# ./$APP_NAME.xpi
# ./$APP_NAME.jar (only if $KEEP_JAR=1)
# ./files -- the list of packaged files
#
# Note: It modifies chrome.manifest when packaging so that it points to
# chrome/$APP_NAME.jar!/*
#
# default configuration file is ./config_build.sh, unless another file is
# specified in command-line. Available config variables:
APP_NAME
=
# short-name, jar and xpi files name. Must be lowercase with no spaces
CHROME_PROVIDERS
=
# which chrome providers we have (space-separated list)
CLEAN_UP
=
# delete the jar / "files" when done? (1/0)
ROOT_FILES
=
# put these files in root of xpi (space separated list of leaf filenames)
ROOT_DIRS
=
# ...and these directories (space separated list)
BEFORE_BUILD
=
# run this before building (bash command)
AFTER_BUILD
=
# ...and this after the build (bash command)
if
[
-z
$1
]
;
then
.
./config_build.sh
else
.
$1
fi
if
[
-z
$APP_NAME
]
;
then
echo
"You need to create build config file first!"
echo
"Read comments at the beginning of this script for more info."
exit
;
fi
ROOT_DIR
=
`
pwd
`
TMP_DIR
=
build
#uncomment to debug
#set -x
# remove any left-over files from previous build
rm
-f
$APP_NAME
.jar
$APP_NAME
.xpi files
rm
-rf
$TMP_DIR
$BEFORE_BUILD
mkdir
-p
-v
$TMP_DIR
/chrome
# generate the JAR file, excluding CVS, SVN, and temporary files
JAR_FILE
=
$TMP_DIR
/chrome/
$APP_NAME
.jar
echo
"Generating
$JAR_FILE
..."
rm
-f
files
;
touch
files
for
CHROME_SUBDIR
in
$CHROME_PROVIDERS
;
do
find
$CHROME_SUBDIR
\(
-path
'*CVS*'
-o
-path
'*.svn*'
\)
-prune
-o
-type
f
-print
|
grep
-v
\~
>>
files
done
zip
-0
-r
$JAR_FILE
-@ < files
echo
$JAR_FILE
>
files
# The following statement should be used instead if you don't wish to use the JAR file
#cp --verbose --parents `cat files` $TMP_DIR/chrome
# prepare components and defaults
echo
"Copying various files to
$TMP_DIR
folder..."
for
DIR
in
$ROOT_DIRS
;
do
mkdir
$TMP_DIR
/
$DIR
FILES
=
"
`
find
$DIR
\(
-path
'*CVS*'
-o
-path
'*.svn*'
\)
-prune
-o
-type
f
-print
|
grep
-v
\~
`
"
echo
$FILES
>>
files
for
f
in
$FILES
;
do
mkdir
-p
-v
"
$TMP_DIR
/
$(
dirname
$f
)
"
cp
-v
$f
"
$TMP_DIR
/
$(
dirname
$f
)
/"
done
done
# Copy other files to the root of future XPI.
for
ROOT_FILE
in
$ROOT_FILES
install.rdf chrome.manifest
;
do
if
[
-f
$ROOT_FILE
]
;
then
cp
-v
$ROOT_FILE
$TMP_DIR
echo
$ROOT_FILE
>>
files
fi
done
cd
$TMP_DIR
if
[
-f
"chrome.manifest"
]
;
then
echo
"Preprocessing chrome.manifest..."
# You think this is scary?
#s/^(content\s+\S*\s+)(\S*\/)$/\1jar:chrome\/$APP_NAME\.jar!\/\2/
#s/^(skin|locale)(\s+\S*\s+\S*\s+)(.*\/)$/\1\2jar:chrome\/$APP_NAME\.jar!\/\3/
#
# Then try this! (Same, but with characters escaped for bash :)
# (it simply adds jar:chrome/whatever.jar!/ at appropriate positions of chrome.manifest)
OS
=
`
uname
`
if
[
"
$OS
"
==
"Darwin"
]
;
then
# OS X version of sed is not GNU...
sed
-i
''
-E
's@^(content[ ]+[^ ]*[ ]+)([^ ]*/)$@\1jar:chrome/'
$APP_NAME
'\.jar\!/\2@'
chrome.manifest
sed
-i
''
-E
's@^(skin|locale)([ ]+[^ ]*[ ]+[^ ]*[ ]+)(.*/)$@\1\2jar:chrome/'
$APP_NAME
'\.jar\!/\3@'
chrome.manifest
else
sed
-i
-r
s/^
\(
content
\\
s+
\\
S
*
\\
s+
\)\(\\
S
*
\\
/
\)
$/
\\
1jar:chrome
\\
/
$APP_NAME
\\
.jar!
\\
/
\\
2/ chrome.manifest
sed
-i
-r
s/^
\(
skin
\|
locale
\)\(\\
s+
\\
S
*
\\
s+
\\
S
*
\\
s+
\)\(
.
*
\\
/
\)
$/
\\
1
\\
2jar:chrome
\\
/
$APP_NAME
\\
.jar!
\\
/
\\
3/ chrome.manifest
fi
fi
# generate the XPI file
echo
"Generating
$APP_NAME
.xpi..."
zip
-r
../
$APP_NAME
.xpi
*
cd
"
$ROOT_DIR
"
echo
"Cleanup..."
if
[
$CLEAN_UP
=
0
]
;
then
# save the jar file
mv
$TMP_DIR
/chrome/
$APP_NAME
.jar
.
else
rm
./files
fi
# remove the working files
rm
-rf
$TMP_DIR
echo
"Done!"
$AFTER_BUILD
config_build.sh
0 → 100755
View file @
2b949b2e
#!/bin/bash
# Build config for the build script, build.sh. Look there for more info.
APP_NAME
=
seafile_for_filelink-last-tb
CHROME_PROVIDERS
=
"content locale"
CLEAN_UP
=
1
ROOT_FILES
=
ROOT_DIRS
=
"components resources"
BEFORE_BUILD
=
BEFORE_PACK
=
AFTER_BUILD
=
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment