mac.SlackBuild 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. #!/bin/bash
  2. # Slackware build script for mac
  3. # Originally written by Luis Henrique <email removed>
  4. # Now maintained by B. Watson <urchlay@slackware.uk>
  5. # Original version of this script had no license. Modified version
  6. # licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/
  7. # for details.
  8. # 20211125 bkw: BUILD=2
  9. # - add -DSHNTOOL to CXXFLAGS, which enables human-readable
  10. # error messages (but not shn support).
  11. # - add README note about 'invalid input file' error.
  12. # - update README and slack-desc.
  13. # - add man page.
  14. # 20190107 bkw:
  15. # - download URL went away, use netbsd pkgsrc
  16. # - add FORCE_SLACK_CFLAGS option (probably nobody needs it)
  17. # 20180105 bkw:
  18. # - take over maintenance
  19. # - update for 3.99_u4_b5_s7 (BUILD=1)
  20. # - add ASM environment variable
  21. # - don't install INSTALL in doc dir
  22. # - get rid of .la file
  23. # - minor script simplification
  24. cd $(dirname $0) ; CWD=$(pwd)
  25. PRGNAM=mac
  26. VERSION=${VERSION:-3.99_u4_b5_s7}
  27. BUILD=${BUILD:-2}
  28. TAG=${TAG:-_SBo}
  29. PKGTYPE=${PKGTYPE:-tgz}
  30. if [ -z "$ARCH" ]; then
  31. case "$( uname -m )" in
  32. i?86) ARCH=i586 ;;
  33. arm*) ARCH=arm ;;
  34. *) ARCH=$( uname -m ) ;;
  35. esac
  36. fi
  37. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  38. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  39. exit 0
  40. fi
  41. TMP=${TMP:-/tmp/SBo}
  42. PKG=$TMP/package-$PRGNAM
  43. OUTPUT=${OUTPUT:-/tmp}
  44. # If we're on x86 or x86_64, with MMX support, there's optimized
  45. # assembly code we can use. If ARCH is unknown, or if ASM=no in
  46. # the environment, disable it.
  47. if [ "$ARCH" = "i586" ]; then
  48. SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  49. LIBDIRSUFFIX=""
  50. ASM=${ASM:-yes}
  51. elif [ "$ARCH" = "i686" ]; then
  52. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  53. LIBDIRSUFFIX=""
  54. ASM=${ASM:-yes}
  55. elif [ "$ARCH" = "x86_64" ]; then
  56. SLKCFLAGS="-O2 -fPIC"
  57. LIBDIRSUFFIX="64"
  58. ASM=${ASM:-yes}
  59. else
  60. SLKCFLAGS="-O2"
  61. LIBDIRSUFFIX=""
  62. ASM=${ASM:-no}
  63. fi
  64. set -e
  65. SRCVER=${VERSION//_/-}
  66. rm -rf $PKG
  67. mkdir -p $TMP $PKG $OUTPUT
  68. cd $TMP
  69. rm -rf $PRGNAM-$SRCVER
  70. tar xvf $CWD/$PRGNAM-$SRCVER.tar.gz
  71. cd $PRGNAM-$SRCVER
  72. chown -R root:root .
  73. find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \
  74. \! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+
  75. if [ "${FORCE_SLACK_CFLAGS:-no}" = "yes" ]; then
  76. sed -i 's,-O3\>,,' configure
  77. fi
  78. patch -p1 < $CWD/gcc6.patch
  79. # This option isn't well explained... it turns on human-readable error
  80. # messages (without it, you get "Error: 1002", no idea WTF it means),
  81. # and the -q (quick verify) option. It does *not* make mac able to
  82. # read/write .shn files... I would never have known any of this from
  83. # reading the docs, had to read the source.
  84. SLKCFLAGS+=" -DSHNTOOL"
  85. # Clean up the usage output a little.
  86. sed -i -e 's,\[EXE\],mac,' \
  87. -e 's,mac\.exe,mac,' \
  88. -e 's,int filenames,filenames w/spaces,' \
  89. src/Console/Console.cpp
  90. LDFLAGS="-Wl,-s" \
  91. CFLAGS="$SLKCFLAGS" \
  92. CXXFLAGS="$SLKCFLAGS" \
  93. ./configure \
  94. --prefix=/usr \
  95. --libdir=/usr/lib${LIBDIRSUFFIX} \
  96. --enable-shared=yes \
  97. --enable-static=no \
  98. --enable-assembly=$ASM \
  99. --build=$ARCH-slackware-linux
  100. make all
  101. make install DESTDIR=$PKG
  102. # We don't need this:
  103. rm -f $PKG/usr/lib$LIBDIRSUFFIX/*.la
  104. # 20211125 bkw: man page by SlackBuild author. I got bored, sorry.
  105. mkdir -p $PKG/usr/man/man1
  106. gzip -9c < $CWD/$PRGNAM.1 > $PKG/usr/man/man1/$PRGNAM.1.gz
  107. PKGDOC=$PKG/usr/doc/$PRGNAM-$VERSION
  108. mkdir -p $PKGDOC
  109. cp -a AUTHORS src/License.htm ChangeLog* NEWS README TODO $PKGDOC
  110. cat $CWD/$PRGNAM.SlackBuild > $PKGDOC/$PRGNAM.SlackBuild
  111. mkdir -p $PKG/install
  112. cat $CWD/slack-desc > $PKG/install/slack-desc
  113. cd $PKG
  114. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE