123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236 |
- #!/bin/sh
- # Slackware build script for basilisk
- # Copyright 2017 Vasily Sora USA
- # All rights reserved.
- #
- # Redistribution and use of this script, with or without modification, is
- # permitted provided that the following conditions are met:
- #
- # 1. Redistributions of this script must retain the above copyright
- # notice, this list of conditions and the following disclaimer.
- #
- # THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
- # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
- # EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- # Modified by SlackBuilds.org
- PRGNAM=basilisk
- VERSION=${VERSION:-2017.12.25}
- BUILD=${BUILD:-1}
- TAG=${TAG:-_SBo}
- if [ -z "$ARCH" ]; then
- case "$( uname -m )" in
- i?86) ARCH=i586 ;;
- arm*) ARCH=arm ;;
- *) ARCH=$( uname -m ) ;;
- esac
- fi
- CWD=$(pwd)
- TMP=${TMP:-/tmp/SBo}
- PKG=$TMP/package-$PRGNAM
- OUTPUT=${OUTPUT:-/tmp}
- # You can try changing the optimization level to simply "-O2" if your processor
- # doesn't support sse2 instructions.
- # "-Os" might help if you experience segfaults.
- OPTIMIZE=${OPTIMIZE:-"-O2 -msse2 -mfpmath=sse"}
- if [ "$ARCH" = "i586" ]; then
- SLKCFLAGS="-O2 -march=i586 -mtune=i686 -fopenmp"
- LIBDIRSUFFIX=""
- elif [ "$ARCH" = "i686" ]; then
- SLKCFLAGS="-O2 -march=i686 -mtune=i686 -fopenmp"
- LIBDIRSUFFIX=""
- elif [ "$ARCH" = "x86_64" ]; then
- SLKCFLAGS="-O2 -fPIC -fopenmp"
- LIBDIRSUFFIX="64"
- else
- SLKCFLAGS="-O2"
- LIBDIRSUFFIX=""
- fi
- # The default is to build with official branding. This SlackBuild is used to
- # produce officially approved third party "contributed builds" of Basilisk.
- # This SlackBuild can also be used to produce unapproved packages -- which
- # requires the use of the "unofficial", or if applicable, "nightly" branding.
- # In general, the "nightly" branding is intended for those building from the
- # master trunck of the Basilisk github repository.
- BRANDING=${BRANDING:---enable-official-branding}
- if [ "$BRANDING" = "unofficial" ]; then
- BRANDING="--disable-official-branding --with-branding=browser/branding/unofficial"
- elif [ "$BRANDING" = "nightly" ]; then
- BRANDING="--disable-official-branding --with-branding=browser/branding/nightly"
- elif [ "$BRANDING" = "aurora" ]; then
- BRANDING="--disable-official-branding --with-branding=browser/branding/aurora"
- fi
- rm -rf $PKG $TMP/obj $TMP/gold
- mkdir -p $TMP $PKG $OUTPUT $TMP/obj $TMP/gold
- DEBUG=" --enable-strip --disable-debug --disable-debug-symbols --enable-release"
- if [ "${ENABLE_DEBUG:-no}" = "yes" ]; then
- DEBUG=" --disable-strip --disable-install-strip --enable-debug --enable-debug-symbols "
- # On IA32, use gold since GNU ld runs out of memory linking libxul.so
- # when debug is turned on
- if [ "$ARCH" = "i586" -o "$ARCH" = "i686" ]; then
- echo "#!/bin/bash" >> $TMP/gold/gold
- echo "/usr/bin/ld.gold \"\$@\"" >> $TMP/gold/gold
- cp $TMP/gold/gold $TMP/gold/ld
- chmod +x $TMP/gold/*
- PATH="$TMP/gold:$PATH"
- export CC="$CC -B$TMP/gold"
- export CXX="$CXX -B$TMP/gold"
- fi
- fi
- set -e
- # We need to use the incredibly ancient autoconf-2.13 for this :/
- # (Taken from Slackware's Firefox build Script)
- cd $TMP
- rm -rf autoconf-2.13
- tar xvf $CWD/autoconf-2.13.tar.xz
- cd autoconf-2.13
- zcat $CWD/autoconf-2.13-consolidated_fixes-1.patch.gz | patch -p1 --verbose
- chown -R root:root .
- find -L . \
- \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
- -o -perm 511 \) -exec chmod 755 {} \; -o \
- \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
- -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
- # Build a temporary copy of autoconf-2.13 only to be used to compile
- # Basilisk, since it somewhat inexplicably requires this ancient version:
- rm -rf $TMP/autoconf-tmp
- mkdir -p $TMP/autoconf-tmp
- # This will be at the beginning of the $PATH, so protect against nonsense
- # happening in $TMP:
- chmod 700 $TMP/autoconf-tmp
- rm -rf $TMP/autoconf-tmp/*
- mkdir -p $TMP/autoconf-tmp/usr
- ./configure \
- --prefix=$TMP/autoconf-tmp/usr \
- --program-suffix=-2.13 \
- --infodir=$TMP/autoconf-tmp/usr/info \
- --mandir=$TMP/autoconf-tmp/usr/man \
- --build=$ARCH-slackware-linux
- make || make -j1
- make install
- PATH=$TMP/autoconf-tmp/usr/bin:$PATH
- # Build basilisk
- cd $TMP
- rm -rf moebius-$VERSION
- tar -xzvf $CWD/moebius-$VERSION.tar.gz
- cd moebius-$VERSION
- chown -R root:root .
- find -L . \
- \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
- -o -perm 511 \) -exec chmod 755 {} \; -o \
- \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
- -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
- # Without LANG=C, building the Python environment may fail with:
- # "UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 36: ordinal not in range(128)"
- export LANG=C
- export MOZCONFIG="$TMP/moebius-$VERSION/.mozconfig"
- export MOZILLA_OFFICIAL=1
- export MOZ_MAKE_FLAGS=$MAKEFLAGS
- export CFLAGS="$SLKCFLAGS"
- export CXXFLAGS="$SLKCFLAGS"
- export BUILDING_RELEASE=1
- export BASILISK_VERSION=1
- export MOZ_ADDON_SIGNING=""
- export MOZ_REQUIRE_SIGNING=""
- export MOZ_TELEMETRY_REPORTING=""
- export PYTHON=/usr/bin/python2
- # Our building options, in a configure-like display ;)
- OPTIONS="\
- ${BRANDING} \
- --prefix=/usr \
- --libdir=/usr/lib${LIBDIRSUFFIX} \
- --with-default-mozilla-five-home=/usr/lib${LIBDIRSUFFIX}/$PRGNAM-$VERSION \
- --x-libraries=/usr/lib${LIBDIRSUFFIX} \
- --enable-default-toolkit=cairo-gtk3 \
- $DEBUG \
- $DEVTOOLS \
- --enable-application=browser \
- --disable-crashreporter \
- --disable-updater \
- --disable-tests \
- --enable-eme=widevine \
- --enable-jemalloc \
- --with-pthreads"
- echo "mk_add_options MOZ_OBJDIR=$TMP/obj" >> .mozconfig
- # Write in the .mozconfig the options above
- for option in $OPTIONS; do echo "ac_add_options $option" >> .mozconfig; done
- echo "ac_add_options --enable-optimize=\"$OPTIMIZE\"" >> .mozconfig
- if ! pkg-config --exists libpulse; then
- echo "ac_add_options --disable-pulseaudio" >> .mozconfig; fi
- python2 mach build
- # Clean up; and package basilisk.
- mkdir -p $PKG/usr/lib${LIBDIRSUFFIX}/mozilla/plugins
- cd $TMP/obj
- make install DESTDIR=$PKG
- cd $PKG
- # We don't need these (just symlinks anyway):
- rm -rf usr/lib${LIBDIRSUFFIX}/$PRGNAM-devel-$VERSION
- # Avoid duplicate binaries; details: https://bugzilla.mozilla.org/show_bug.cgi?id=658850
- # Basilisk package scripts appear to attempt this, on other 'distros'; those scripts,
- # however, appear to fail on Slackware.
- rm -f usr/lib${LIBDIRSUFFIX}/$PRGNAM-$VERSION/$PRGNAM-bin
- # Use system provided Hunspell, if desired.
- if [ "${USE_SYSTEM_HUNSPELL}" = "yes" ]; then
- rm -rfv usr/lib${LIBDIRSUFFIX}/$PRGNAM-$VERSION/dictionaries
- cp -vsr /usr/share/hunspell usr/lib${LIBDIRSUFFIX}/$PRGNAM-$VERSION/dictionaries
- fi
- # Install icons:
- for PX in 16 32 48 ; do
- mkdir -p $PKG/usr/share/icons/hicolor/${PX}x${PX}/apps
- ln -s /usr/lib${LIBDIRSUFFIX}/$PRGNAM-$VERSION/browser/chrome/icons/default/default${PX}.png \
- $PKG/usr/share/icons/hicolor/${PX}x${PX}/apps/${PRGNAM}-$VERSION.png
- done
- # ... and the 128px icon file too:
- mkdir -p $PKG/usr/share/icons/hicolor/128x128/apps
- ln -s /usr/lib${LIBDIRSUFFIX}/$PRGNAM-$VERSION/browser/icons/mozicon128.png \
- $PKG/usr/share/icons/hicolor/128x128/apps/${PRGNAM}-$VERSION.png
- # Install .desktop file
- mkdir -p $PKG/usr/share/applications
- sed "s|@VERSION@|$VERSION|" $CWD/$PRGNAM.desktop \
- > $PKG/usr/share/applications/$PRGNAM.desktop
- mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
- cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
- mkdir -p $PKG/install
- cat $CWD/slack-desc > $PKG/install/slack-desc
- cat $CWD/doinst.sh > $PKG/install/doinst.sh
- /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}
|