basilisk.SlackBuild 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  1. #!/bin/sh
  2. # Slackware build script for basilisk
  3. # Copyright 2017 Vasily Sora USA
  4. # All rights reserved.
  5. #
  6. # Redistribution and use of this script, with or without modification, is
  7. # permitted provided that the following conditions are met:
  8. #
  9. # 1. Redistributions of this script must retain the above copyright
  10. # notice, this list of conditions and the following disclaimer.
  11. #
  12. # THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
  13. # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  14. # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
  15. # EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  16. # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  17. # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  18. # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  19. # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  20. # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  21. # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  22. # Modified by SlackBuilds.org
  23. PRGNAM=basilisk
  24. VERSION=${VERSION:-2017.12.25}
  25. BUILD=${BUILD:-1}
  26. TAG=${TAG:-_SBo}
  27. if [ -z "$ARCH" ]; then
  28. case "$( uname -m )" in
  29. i?86) ARCH=i586 ;;
  30. arm*) ARCH=arm ;;
  31. *) ARCH=$( uname -m ) ;;
  32. esac
  33. fi
  34. CWD=$(pwd)
  35. TMP=${TMP:-/tmp/SBo}
  36. PKG=$TMP/package-$PRGNAM
  37. OUTPUT=${OUTPUT:-/tmp}
  38. # You can try changing the optimization level to simply "-O2" if your processor
  39. # doesn't support sse2 instructions.
  40. # "-Os" might help if you experience segfaults.
  41. OPTIMIZE=${OPTIMIZE:-"-O2 -msse2 -mfpmath=sse"}
  42. if [ "$ARCH" = "i586" ]; then
  43. SLKCFLAGS="-O2 -march=i586 -mtune=i686 -fopenmp"
  44. LIBDIRSUFFIX=""
  45. elif [ "$ARCH" = "i686" ]; then
  46. SLKCFLAGS="-O2 -march=i686 -mtune=i686 -fopenmp"
  47. LIBDIRSUFFIX=""
  48. elif [ "$ARCH" = "x86_64" ]; then
  49. SLKCFLAGS="-O2 -fPIC -fopenmp"
  50. LIBDIRSUFFIX="64"
  51. else
  52. SLKCFLAGS="-O2"
  53. LIBDIRSUFFIX=""
  54. fi
  55. # The default is to build with official branding. This SlackBuild is used to
  56. # produce officially approved third party "contributed builds" of Basilisk.
  57. # This SlackBuild can also be used to produce unapproved packages -- which
  58. # requires the use of the "unofficial", or if applicable, "nightly" branding.
  59. # In general, the "nightly" branding is intended for those building from the
  60. # master trunck of the Basilisk github repository.
  61. BRANDING=${BRANDING:---enable-official-branding}
  62. if [ "$BRANDING" = "unofficial" ]; then
  63. BRANDING="--disable-official-branding --with-branding=browser/branding/unofficial"
  64. elif [ "$BRANDING" = "nightly" ]; then
  65. BRANDING="--disable-official-branding --with-branding=browser/branding/nightly"
  66. elif [ "$BRANDING" = "aurora" ]; then
  67. BRANDING="--disable-official-branding --with-branding=browser/branding/aurora"
  68. fi
  69. rm -rf $PKG $TMP/obj $TMP/gold
  70. mkdir -p $TMP $PKG $OUTPUT $TMP/obj $TMP/gold
  71. DEBUG=" --enable-strip --disable-debug --disable-debug-symbols --enable-release"
  72. if [ "${ENABLE_DEBUG:-no}" = "yes" ]; then
  73. DEBUG=" --disable-strip --disable-install-strip --enable-debug --enable-debug-symbols "
  74. # On IA32, use gold since GNU ld runs out of memory linking libxul.so
  75. # when debug is turned on
  76. if [ "$ARCH" = "i586" -o "$ARCH" = "i686" ]; then
  77. echo "#!/bin/bash" >> $TMP/gold/gold
  78. echo "/usr/bin/ld.gold \"\$@\"" >> $TMP/gold/gold
  79. cp $TMP/gold/gold $TMP/gold/ld
  80. chmod +x $TMP/gold/*
  81. PATH="$TMP/gold:$PATH"
  82. export CC="$CC -B$TMP/gold"
  83. export CXX="$CXX -B$TMP/gold"
  84. fi
  85. fi
  86. set -e
  87. # We need to use the incredibly ancient autoconf-2.13 for this :/
  88. # (Taken from Slackware's Firefox build Script)
  89. cd $TMP
  90. rm -rf autoconf-2.13
  91. tar xvf $CWD/autoconf-2.13.tar.xz
  92. cd autoconf-2.13
  93. zcat $CWD/autoconf-2.13-consolidated_fixes-1.patch.gz | patch -p1 --verbose
  94. chown -R root:root .
  95. find -L . \
  96. \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
  97. -o -perm 511 \) -exec chmod 755 {} \; -o \
  98. \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
  99. -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
  100. # Build a temporary copy of autoconf-2.13 only to be used to compile
  101. # Basilisk, since it somewhat inexplicably requires this ancient version:
  102. rm -rf $TMP/autoconf-tmp
  103. mkdir -p $TMP/autoconf-tmp
  104. # This will be at the beginning of the $PATH, so protect against nonsense
  105. # happening in $TMP:
  106. chmod 700 $TMP/autoconf-tmp
  107. rm -rf $TMP/autoconf-tmp/*
  108. mkdir -p $TMP/autoconf-tmp/usr
  109. ./configure \
  110. --prefix=$TMP/autoconf-tmp/usr \
  111. --program-suffix=-2.13 \
  112. --infodir=$TMP/autoconf-tmp/usr/info \
  113. --mandir=$TMP/autoconf-tmp/usr/man \
  114. --build=$ARCH-slackware-linux
  115. make || make -j1
  116. make install
  117. PATH=$TMP/autoconf-tmp/usr/bin:$PATH
  118. # Build basilisk
  119. cd $TMP
  120. rm -rf moebius-$VERSION
  121. tar -xzvf $CWD/moebius-$VERSION.tar.gz
  122. cd moebius-$VERSION
  123. chown -R root:root .
  124. find -L . \
  125. \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
  126. -o -perm 511 \) -exec chmod 755 {} \; -o \
  127. \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
  128. -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
  129. # Without LANG=C, building the Python environment may fail with:
  130. # "UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 36: ordinal not in range(128)"
  131. export LANG=C
  132. export MOZCONFIG="$TMP/moebius-$VERSION/.mozconfig"
  133. export MOZILLA_OFFICIAL=1
  134. export MOZ_MAKE_FLAGS=$MAKEFLAGS
  135. export CFLAGS="$SLKCFLAGS"
  136. export CXXFLAGS="$SLKCFLAGS"
  137. export BUILDING_RELEASE=1
  138. export BASILISK_VERSION=1
  139. export MOZ_ADDON_SIGNING=""
  140. export MOZ_REQUIRE_SIGNING=""
  141. export MOZ_TELEMETRY_REPORTING=""
  142. export PYTHON=/usr/bin/python2
  143. # Our building options, in a configure-like display ;)
  144. OPTIONS="\
  145. ${BRANDING} \
  146. --prefix=/usr \
  147. --libdir=/usr/lib${LIBDIRSUFFIX} \
  148. --with-default-mozilla-five-home=/usr/lib${LIBDIRSUFFIX}/$PRGNAM-$VERSION \
  149. --x-libraries=/usr/lib${LIBDIRSUFFIX} \
  150. --enable-default-toolkit=cairo-gtk3 \
  151. $DEBUG \
  152. $DEVTOOLS \
  153. --enable-application=browser \
  154. --disable-crashreporter \
  155. --disable-updater \
  156. --disable-tests \
  157. --enable-eme=widevine \
  158. --enable-jemalloc \
  159. --with-pthreads"
  160. echo "mk_add_options MOZ_OBJDIR=$TMP/obj" >> .mozconfig
  161. # Write in the .mozconfig the options above
  162. for option in $OPTIONS; do echo "ac_add_options $option" >> .mozconfig; done
  163. echo "ac_add_options --enable-optimize=\"$OPTIMIZE\"" >> .mozconfig
  164. if ! pkg-config --exists libpulse; then
  165. echo "ac_add_options --disable-pulseaudio" >> .mozconfig; fi
  166. python2 mach build
  167. # Clean up; and package basilisk.
  168. mkdir -p $PKG/usr/lib${LIBDIRSUFFIX}/mozilla/plugins
  169. cd $TMP/obj
  170. make install DESTDIR=$PKG
  171. cd $PKG
  172. # We don't need these (just symlinks anyway):
  173. rm -rf usr/lib${LIBDIRSUFFIX}/$PRGNAM-devel-$VERSION
  174. # Avoid duplicate binaries; details: https://bugzilla.mozilla.org/show_bug.cgi?id=658850
  175. # Basilisk package scripts appear to attempt this, on other 'distros'; those scripts,
  176. # however, appear to fail on Slackware.
  177. rm -f usr/lib${LIBDIRSUFFIX}/$PRGNAM-$VERSION/$PRGNAM-bin
  178. # Use system provided Hunspell, if desired.
  179. if [ "${USE_SYSTEM_HUNSPELL}" = "yes" ]; then
  180. rm -rfv usr/lib${LIBDIRSUFFIX}/$PRGNAM-$VERSION/dictionaries
  181. cp -vsr /usr/share/hunspell usr/lib${LIBDIRSUFFIX}/$PRGNAM-$VERSION/dictionaries
  182. fi
  183. # Install icons:
  184. for PX in 16 32 48 ; do
  185. mkdir -p $PKG/usr/share/icons/hicolor/${PX}x${PX}/apps
  186. ln -s /usr/lib${LIBDIRSUFFIX}/$PRGNAM-$VERSION/browser/chrome/icons/default/default${PX}.png \
  187. $PKG/usr/share/icons/hicolor/${PX}x${PX}/apps/${PRGNAM}-$VERSION.png
  188. done
  189. # ... and the 128px icon file too:
  190. mkdir -p $PKG/usr/share/icons/hicolor/128x128/apps
  191. ln -s /usr/lib${LIBDIRSUFFIX}/$PRGNAM-$VERSION/browser/icons/mozicon128.png \
  192. $PKG/usr/share/icons/hicolor/128x128/apps/${PRGNAM}-$VERSION.png
  193. # Install .desktop file
  194. mkdir -p $PKG/usr/share/applications
  195. sed "s|@VERSION@|$VERSION|" $CWD/$PRGNAM.desktop \
  196. > $PKG/usr/share/applications/$PRGNAM.desktop
  197. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  198. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  199. mkdir -p $PKG/install
  200. cat $CWD/slack-desc > $PKG/install/slack-desc
  201. cat $CWD/doinst.sh > $PKG/install/doinst.sh
  202. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}