hxtools.SlackBuild 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. #!/bin/bash
  2. # Slackware build script for hxtools
  3. # Written by B. Watson (urchlay@slackware.uk)
  4. # Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.
  5. # This build includes both hxtools and the libHX library it depends
  6. # on. In the unlikely event that someone finds another project that
  7. # depends on libHX and wants to package it up for SBo, whatever it is
  8. # can just list hxtools as a dependency.
  9. # 20230109 bkw: update for v20221120, include new consoleet-utils.
  10. # TODO: package up the consoleet fonts, too (in a separate build).
  11. cd $(dirname $0) ; CWD=$(pwd)
  12. PRGNAM=hxtools
  13. VERSION=${VERSION:-20221120}
  14. BUILD=${BUILD:-1}
  15. TAG=${TAG:-_SBo}
  16. PKGTYPE=${PKGTYPE:-tgz}
  17. if [ -z "$ARCH" ]; then
  18. case "$( uname -m )" in
  19. i?86) ARCH=i586 ;;
  20. arm*) ARCH=arm ;;
  21. *) ARCH=$( uname -m ) ;;
  22. esac
  23. fi
  24. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  25. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  26. exit 0
  27. fi
  28. TMP=${TMP:-/tmp/SBo}
  29. PKG=$TMP/package-$PRGNAM
  30. OUTPUT=${OUTPUT:-/tmp}
  31. if [ "$ARCH" = "i586" ]; then
  32. SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  33. LIBDIRSUFFIX=""
  34. elif [ "$ARCH" = "i686" ]; then
  35. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  36. LIBDIRSUFFIX=""
  37. elif [ "$ARCH" = "x86_64" ]; then
  38. SLKCFLAGS="-O2 -fPIC"
  39. LIBDIRSUFFIX="64"
  40. else
  41. SLKCFLAGS="-O2"
  42. LIBDIRSUFFIX=""
  43. fi
  44. set -e
  45. LIBNAM=libHX
  46. LIBVER=${LIBVER:-4.8}
  47. LEETNAM=consoleet-utils
  48. LEETVER=${LEETVER:-1.1}
  49. PKGDOC=$PKG/usr/doc/$PRGNAM-$VERSION
  50. LIBDOC=$PKGDOC/$LIBNAM-$LIBVER
  51. LEETDOC=$PKGDOC/$LEETNAM-$LEETVER
  52. rm -rf $PKG
  53. mkdir -p $TMP $PKG $OUTPUT
  54. cd $TMP
  55. rm -rf $PRGNAM
  56. mkdir -p $PRGNAM
  57. cd $PRGNAM
  58. TOPDIR="$( pwd )"
  59. tar xvf $CWD/$PRGNAM-$VERSION.tar.zst
  60. tar xvf $CWD/$LIBNAM-$LIBVER.tar.xz
  61. tar xvf $CWD/$LEETNAM-$LEETVER.tar.zst
  62. chown -R root:root .
  63. find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \
  64. \! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+
  65. ### libHX:
  66. cd $LIBNAM-$LIBVER
  67. CFLAGS="$SLKCFLAGS" \
  68. CXXFLAGS="$SLKCFLAGS" \
  69. ./configure \
  70. --prefix=/usr \
  71. --libdir=/usr/lib${LIBDIRSUFFIX} \
  72. --sysconfdir=/etc \
  73. --localstatedir=/var \
  74. --mandir=/usr/man \
  75. --docdir=/usr/doc/$PRGNAM-$VERSION \
  76. --disable-static \
  77. --build=$ARCH-slackware-linux
  78. make # V=1
  79. make install-strip DESTDIR=$PKG
  80. rm -f $PKG/usr/lib*/*.la
  81. # LICENSE.GPL3 and LICENSE.WTFPL are also in hxtools, don't install here.
  82. mkdir -p $LIBDOC
  83. cp -a COPYING LICENSE.LGPL* *.rst doc $LIBDOC
  84. ### hxtools itself, link with the libHX in $PKG:
  85. cd $TOPDIR/$PRGNAM-$VERSION
  86. # look for extract_dfqshared.pm in /usr/share/$PRGNAM, not /usr/bin.
  87. patch -p1 < $CWD/shared_perl_lib.diff
  88. libHX_CFLAGS="-I$PKG/usr/include" \
  89. libHX_LIBS="-L$PKG/usr/lib$LIBDIRSUFFIX -lHX" \
  90. CFLAGS="$SLKCFLAGS" \
  91. CXXFLAGS="$SLKCFLAGS" \
  92. ./configure \
  93. --prefix=/usr \
  94. --libdir=/usr/lib${LIBDIRSUFFIX} \
  95. --sysconfdir=/etc \
  96. --localstatedir=/var \
  97. --mandir=/usr/man \
  98. --docdir=/usr/doc/$PRGNAM-$VERSION \
  99. --disable-static \
  100. --build=$ARCH-slackware-linux
  101. make # V=1
  102. make install-strip DESTDIR=$PKG
  103. # dunno why so much stuff is installed in libexec... easier to
  104. # move it after the fact than patch the autotools stuff to fix it.
  105. mv $PKG/usr/libexec/$PRGNAM/* $PKG/usr/bin
  106. rm -rf $PKG/usr/libexec
  107. # move this to where the patched extract_* tools expect to find it.
  108. install -m0644 $PKG/usr/bin/extract_dfqshared.pm $PKG/usr/share/$PRGNAM
  109. rm -f $PKG/usr/bin/extract_dfqshared.pm
  110. # these don't get installed by 'make install'
  111. install -m0755 sadmin/filenameconv $PKG/usr/bin
  112. install -s -m0755 smath/graph-{fanout,lchain} $PKG/usr/bin
  113. # nor these...
  114. mkdir -p $PKG/usr/sbin
  115. install -m0755 sadmin/raregetty $PKG/usr/sbin
  116. # this isn't useful on Slackware, is it?
  117. install -m0755 sadmin/rpmdep.pl $PKG/usr/sbin
  118. cp -a doc/filenameconv.1 $PKG/usr/man/man1
  119. cp -a doc/raregetty.8 $PKG/usr/man/man8
  120. # these 2 conflict with bsd-games and man-db:
  121. rm -f $PKG/usr/bin/{rot13,man2html} \
  122. $PKG/usr/man/man1/{rot13,man2html}.1
  123. # there's also a bin2c in SBo's cudatoolkit, but it's installed to
  124. # /usr/share/cuda/bin, so there's no conflict here.
  125. # redundant copy (the other one's in etc/):
  126. rm -f $PKG/usr/share/hxtools/hxloginpref.conf
  127. cp -a LICENSE* doc/*.rst examples $PKGDOC
  128. ### consoleet-utils (used to be included in hxtools).
  129. cd $TOPDIR/$LEETNAM-$LEETVER
  130. libHX_CFLAGS="-I$PKG/usr/include" \
  131. libHX_LIBS="-L$PKG/usr/lib$LIBDIRSUFFIX -lHX" \
  132. CFLAGS="$SLKCFLAGS" \
  133. CXXFLAGS="$SLKCFLAGS" \
  134. ./configure \
  135. --prefix=/usr \
  136. --libdir=/usr/lib${LIBDIRSUFFIX} \
  137. --sysconfdir=/etc \
  138. --localstatedir=/var \
  139. --mandir=/usr/man \
  140. --docdir=/usr/doc/$PRGNAM-$VERSION \
  141. --disable-static \
  142. --build=$ARCH-slackware-linux
  143. make # V=1
  144. make install-strip DESTDIR=$PKG
  145. mkdir -p $LEETDOC
  146. cp -a doc/changelog.rst $LEETDOC
  147. gzip -9 $PKG/usr/man/man*/*
  148. # symlink redundant licenses
  149. ln -s ../LICENSE.GPL3 $LIBDOC/LICENSE.GPL3
  150. ln -s ../LICENSE.GPL3 $LEETDOC/LICENSE.GPL3
  151. ln -s ../LICENSE.MIT $LEETDOC/LICENSE.MIT
  152. cat $CWD/$PRGNAM.SlackBuild > $PKGDOC/$PRGNAM.SlackBuild
  153. mkdir -p $PKG/install
  154. cat $CWD/slack-desc > $PKG/install/slack-desc
  155. cd $PKG
  156. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE