cleanup of build.sh, now giving help by default

This commit is contained in:
Bert van der Weerd 2021-02-27 21:57:16 +01:00
parent e8bd36e0c2
commit d53b3c8381
No known key found for this signature in database
GPG key ID: 4CFABB96ADE0F5B1

View file

@ -10,13 +10,36 @@ pkgver=86.0
fetch() { fetch() {
echo "fetch: begin." echo "fetch: begin."
# fetch the firefox source. # fetch the firefox source.
rm -f firefox-$pkgver.source.tar.xz rm -f firefox-$pkgver.source.tar.xz
wget https://archive.mozilla.org/pub/firefox/releases/$pkgver/source/firefox-$pkgver.source.tar.xz wget https://archive.mozilla.org/pub/firefox/releases/$pkgver/source/firefox-$pkgver.source.tar.xz
if [ $? -ne 0 ]; then exit 1; fi if [ $? -ne 0 ]; then exit 1; fi
if [ ! -f firefox-$pkgver.source.tar.xz ]; then exit 1; fi if [ ! -f firefox-$pkgver.source.tar.xz ]; then exit 1; fi
# the settings and common submodules should be checked out with --recursive to allow the build echo "fetch: done."
}
extract() {
echo "extract: begin."
echo "Deleting previous firefox-${pkgver} ..."
rm -rf firefox-$pkgver
echo "Extracting firefox-$pkgver.source.tar.xz ..."
tar xf firefox-$pkgver.source.tar.xz
if [ $? -ne 0 ]; then exit 1; fi
if [ ! -d firefox-$pkgver ]; then exit 1; fi
echo "extract: done."
}
do_patches() {
echo "do_patches: begin."
# get the patches # get the patches
echo 'Getting patches..' echo 'Getting patches..'
@ -27,26 +50,7 @@ fetch() {
wget -q https://gitlab.com/librewolf-community/browser/linux/-/raw/master/remove_addons.patch wget -q https://gitlab.com/librewolf-community/browser/linux/-/raw/master/remove_addons.patch
if [ $? -ne 0 ]; then exit 1; fi if [ $? -ne 0 ]; then exit 1; fi
if [ ! -f remove_addons.patch ]; then exit 1; fi if [ ! -f remove_addons.patch ]; then exit 1; fi
echo "fetch: done."
}
prepare() {
echo "prepare: begin."
echo "Deleting previous firefox-${pkgver} ..."
rm -rf firefox-$pkgver
echo "Extracting firefox-$pkgver.source.tar.xz ..."
tar xf firefox-$pkgver.source.tar.xz
if [ $? -ne 0 ]; then exit 1; fi
if [ ! -d firefox-$pkgver ]; then exit 1; fi
echo "prepare: done."
}
do_patches() {
echo "do_patches: begin."
if [ ! -d firefox-$pkgver ]; then exit 1; fi if [ ! -d firefox-$pkgver ]; then exit 1; fi
cd firefox-$pkgver cd firefox-$pkgver
@ -154,8 +158,10 @@ build() {
echo "build: begin." echo "build: begin."
if [ ! -d firefox-$pkgver ]; then exit 1; fi if [ ! -d firefox-$pkgver ]; then exit 1; fi
cd firefox-$pkgver cd firefox-$pkgver
./mach build ./mach build
if [ $? -ne 0 ]; then exit 1; fi if [ $? -ne 0 ]; then exit 1; fi
cd .. cd ..
echo "build: done." echo "build: done."
} }
@ -166,8 +172,10 @@ package() {
echo "package: begin." echo "package: begin."
if [ ! -d firefox-$pkgver ]; then exit 1; fi if [ ! -d firefox-$pkgver ]; then exit 1; fi
cd firefox-$pkgver cd firefox-$pkgver
./mach package ./mach package
if [ $? -ne 0 ]; then exit 1; fi if [ $? -ne 0 ]; then exit 1; fi
cd .. cd ..
echo "package: done." echo "package: done."
} }
@ -199,13 +207,15 @@ fi
# process commandline arguments and do something # process commandline arguments and do something
done_something=0 done_something=0
if [[ "$*" == *fetch* ]]; then if [[ "$*" == *fetch* ]]; then
fetch fetch
done_something=1 done_something=1
fi fi
if [[ "$*" == *prepare* ]]; then if [[ "$*" == *extract* ]]; then
prepare extract
done_something=1 done_something=1
fi fi
if [[ "$*" == *do_patches* ]]; then if [[ "$*" == *do_patches* ]]; then
@ -225,12 +235,20 @@ if [[ "$*" == *installer_win* ]]; then
done_something=1 done_something=1
fi fi
# by default, do the whole thing.. # by default, give help..
if (( done_something == 0 )); then if (( done_something == 0 )); then
fetch cat <<EOF
prepare Use: ./build.sh fetch extract do_patches build package installer_win
do_patches
build fetch - fetch the tarball
package extract - extract the tarball
installer_win do_patches - create a mozconfig, and patch the source
build - the actual build, takes about an hour for me.
package - this builds the dist zip file we need.
installer_win - build the windows NSIS setup.exe installer.
If no parameters are given, it prints this help message.
EOF
exit 1
fi fi