diff --git a/build.sh b/build.sh index 8129294..6d926fe 100644 --- a/build.sh +++ b/build.sh @@ -5,7 +5,6 @@ pkgname=librewolf _pkgname=LibreWolf pkgver=85.0 -#srcdir=/c/mozilla-source @@ -23,8 +22,6 @@ fetch() { - - prepare() { rm -rf firefox-$pkgver tar xf firefox-$pkgver.source.tar.xz @@ -69,31 +66,39 @@ mk_add_options MOZ_TELEMETRY_REPORTING=0 END + patch -p1 -i ../remove_addons.patch patch -p1 -i ../megabar.patch patch -p1 -i ../unity-menubar.patch - + # Disabling Pocket sed -i "s/'pocket'/#'pocket'/g" browser/components/moz.build # this one only to remove an annoying error message: sed -i 's#SaveToPocket.init();#// SaveToPocket.init();#g' browser/components/BrowserGlue.jsm - + # Remove Internal Plugin Certificates _cert_sed='s#if (aCert.organizationalUnit == "Mozilla [[:alpha:]]\+") {\n' _cert_sed+='[[:blank:]]\+return AddonManager\.SIGNEDSTATE_[[:upper:]]\+;\n' _cert_sed+='[[:blank:]]\+}#' _cert_sed+='// NOTE: removed#g' - - # FIXME: on windows: the sed.exe in MozBuild is too old, no -z, using the one from Git instead. - mysed='/c/mozilla-source/Git/usr/bin/sed.exe' + # on windows: the sed.exe in MozBuild is too old, no -z, using the one from Git instead. + if [ -f '/c/mozilla-build/start-shell.bat' ]; then + mysed='/c/mozilla-source/Git/usr/bin/sed.exe' + if [ ! -f $mysed ]; then + echo 'build.sh: For the build to work, copy "c:\program files\Git" folder into "c:\mozilla-source".' + exit + fi + else + $mysed='sed' + fi $mysed -z "$_cert_sed" -i toolkit/mozapps/extensions/internal/XPIInstall.jsm - + # allow SearchEngines option in non-ESR builds sed -i 's#"enterprise_only": true,#"enterprise_only": false,#g' browser/components/enterprisepolicies/schemas/policies-schema.json @@ -107,28 +112,25 @@ END - cp -r ../common/source_files/* ./ + # FIXME: this 'mozconfig' file in the 'common' submodule should be removed - # this submodule is purely for the branding. I imagine that we want the - # missing_branding_files into the 'common' submodule. + # this submodule is purely for the branding. rm -f mozconfig - # FIX: on windows: the stubinstaller folder is missing from the librewolf branding folder. + # FIXME: on windows: the stubinstaller folder is missing from the librewolf branding folder. + # this might be a bug in FF however as it seems to take missing branding resources from + # the nightly branding. We probably want this stuff merged into the 'common' submodule. cp -r ../missing_branding_files/stubinstaller browser/branding/librewolf # just a straight copy for now.. cp ../mozconfig .mozconfig - + cd .. } - - - - build() { cd firefox-$pkgver @@ -138,13 +140,21 @@ build() { } + package() { cd firefox-$pkgver ./mach package + cd .. +} + +installer_win() { + cd firefox-$pkgver + # apply the LibreWolf settings cp -rv ../settings/* obj-x86_64-pc-mingw32/dist/librewolf + # recreate the zip file.. cd obj-x86_64-pc-mingw32/dist rm -f librewolf-$pkgver.en-US.win64.txt librewolf-$pkgver.en-US.win64.zip @@ -152,19 +162,26 @@ package() { /c/mozilla-source/Git/usr/bin/sha256sum.exe librewolf-$pkgver.en-US.win64.zip > librewolf-$pkgver.en-US.win64.zip.sha256sum cp librewolf-$pkgver.en-US.win64.zip* ../../.. cd ../.. - + + cd .. +} + +installer_macos() { + cd firefox-$pkgver + + # TODO: we want to apply the librewolf settings and make the .dmg file here. + echo 'build.sh: installer_macos() Not implemented yet.' cd .. } - - - # windows: change $PATH to find all the build tools in .mozbuild -# this might do the trick on macos aswell -export TPATH=$HOME/.mozbuild/clang/bin:$HOME/.mozbuild/cbindgen:$HOME/.mozbuild/node:$HOME/.mozbuild/nasm -export PATH=$TPATH:$PATH +# this might do the trick on macos aswell? +if [ -f '/c/mozilla-build/start-shell.bat' ]; then + export TPATH=$HOME/.mozbuild/clang/bin:$HOME/.mozbuild/cbindgen:$HOME/.mozbuild/node:$HOME/.mozbuild/nasm + export PATH=$TPATH:$PATH +fi @@ -186,8 +203,16 @@ if [[ "$*" == *package* ]]; then package done_something=1 fi - -if (( done_something == 0 )); then - echo "Usage: $0 fetch | prepare | build | package" +if [[ "$*" == *installer_win* ]]; then + installer_win + done_something=1 +fi +if [[ "$*" == *installer_macos* ]]; then + installer_macos + done_something=1 fi +if (( done_something == 0 )); then + echo "Usage: $0 fetch | prepare | build | package | installer_win | installer_mac" + exit +fi