hamlib.SlackBuild 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. #!/bin/bash
  2. # SlackBuild script for Hamlib
  3. # Copyright 2010 Howard Pepper <h_pepper {at} bellsouth [dot] net>
  4. # Copyright 2017,2018 Nate Bargmann <n0nb@arrl.net>
  5. # Copyright 2020 JK Wood <joshuakwood@gmail.com>
  6. # All rights reserved.
  7. #
  8. # Redistribution and use of this script, with or without modification, is
  9. # permitted provided that the following conditions are met:
  10. #
  11. # 1. Redistributions of this script must retain the above copyright
  12. # notice, this list of conditions and the following disclaimer.
  13. #
  14. # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR IMPLIED
  15. # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  16. # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
  17. # EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  18. # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  19. # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  20. # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  21. # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  22. # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  23. # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  24. cd $(dirname $0) ; CWD=$(pwd)
  25. PRGNAM=hamlib
  26. VERSION=${VERSION:-3.3}
  27. BUILD=${BUILD:-1}
  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 the variable PRINT_PACKAGE_NAME is set, then this script will report what
  38. # the name of the created package would be, and then exit. This information
  39. # could be useful to other scripts.
  40. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  41. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  42. exit 0
  43. fi
  44. TMP=${TMP:-/tmp/SBo}
  45. PKG=$TMP/package-$PRGNAM
  46. OUTPUT=${OUTPUT:-/tmp}
  47. DOCFILES="AUTHORS COPYING COPYING.LIB ChangeLog INSTALL LICENSE NEWS PLAN
  48. README README.betatester README.developer THANKS TODO"
  49. if [ "$ARCH" = "i586" ]; then
  50. SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  51. LIBDIRSUFFIX=""
  52. elif [ "$ARCH" = "i686" ]; then
  53. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  54. LIBDIRSUFFIX=""
  55. elif [ "$ARCH" = "x86_64" ]; then
  56. SLKCFLAGS="-O2 -fPIC"
  57. LIBDIRSUFFIX="64"
  58. else
  59. SLKCFLAGS="-O2"
  60. LIBDIRSUFFIX=""
  61. fi
  62. set -e
  63. rm -rf $PKG
  64. mkdir -p $TMP $PKG $OUTPUT
  65. cd $TMP
  66. rm -rf $PRGNAM-$VERSION
  67. tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
  68. cd $PRGNAM-$VERSION
  69. chown -R root:root .
  70. find -L . \
  71. \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
  72. -o -perm 511 \) -exec chmod 755 {} \; -o \
  73. \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
  74. -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
  75. if [ x"${PL_MOD}" = x"yes" ]; then
  76. PERL_BINDING="--with-perl-binding"
  77. else
  78. PERL_BINDING=""
  79. fi
  80. if { [ x"${PY_MOD}" = x"yes" ] || [ x"${PY3_MOD}" = x"yes" ]; } then
  81. PYTHON_BINDING="--with-python-binding"
  82. PYV=`python -c "import sys;t='{v[0]}.{v[1]}'.format(v=list(sys.version_info[:2]));sys.stdout.write(t)";`
  83. else
  84. PYTHON_BINDING=""
  85. fi
  86. if [ x"${PY3_MOD}" = x"yes" ]; then
  87. export PYTHON=`which python3`
  88. PYV=`python3 -c "import sys;t='{v[0]}.{v[1]}'.format(v=list(sys.version_info[:2]));sys.stdout.write(t)";`
  89. fi
  90. if [ x"${TCL_MOD}" = x"yes" ]; then
  91. TCL_BINDING="--with-tcl-binding"
  92. TCLV=`echo 'puts $tcl_version;exit 0' | tclsh`
  93. else
  94. TCL_BINDING=""
  95. fi
  96. # Only if Lua >= 5.2 installed
  97. if { [ x"${LUA_VER}" = x"5.2" ] || [ x"${LUA_VER}" = x"5.3" ]; } then
  98. LUA_BINDING="--with-lua-binding"
  99. export LUA_INCLUDE="-I/usr/include/lua${LUA_VER}"
  100. export LUA="/usr/bin/lua${LUA_VER}"
  101. else
  102. LUA_BINDING=""
  103. fi
  104. CFLAGS="$SLKCFLAGS" \
  105. CXXFLAGS="$SLKCFLAGS" \
  106. ./configure \
  107. --prefix=/usr \
  108. --libdir=/usr/lib${LIBDIRSUFFIX} \
  109. --mandir=/usr/man \
  110. --docdir=/usr/doc/$PRGNAM-$VERSION \
  111. --infodir=/usr/info \
  112. --disable-static \
  113. --disable-html-matrix \
  114. $PERL_BINDING \
  115. $PYTHON_BINDING \
  116. $TCL_BINDING \
  117. $LUA_BINDING
  118. # Fix linking when --libdir=/usr/lib64
  119. sed -i \
  120. -e '/RANLIB/s:$(libdir)/\(.*LIBNAME)\):$(libdir)/`basename \1`:g' \
  121. src/Makefile
  122. make
  123. make install DESTDIR=$PKG
  124. find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
  125. | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
  126. find $PKG/usr/man -type f -exec gzip -9 {} \;
  127. for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
  128. rm -f $PKG/usr/info/dir
  129. gzip -9 $PKG/usr/info/*.info*
  130. if [ x"${PL_MOD}" = x"yes" ]; then
  131. find $PKG -name perllocal.pod \
  132. -o -name ".packlist" \
  133. -o -name "*.bs" \
  134. | xargs rm -f
  135. fi
  136. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION/
  137. cp -a $DOCFILES $PKG/usr/doc/$PRGNAM-$VERSION
  138. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  139. if [ x"${PY_MOD}" = x"yes" ]; then
  140. rm -f $PKG/usr/lib${LIBDIRSUFFIX}/python${PYV}/site-packages/_Hamlib.la
  141. rm -f $PKG/usr/lib${LIBDIRSUFFIX}/python${PYV}/site-packages/Hamlib.pyo
  142. fi
  143. if [ x"${PY3_MOD}" = x"yes" ]; then
  144. rm -f $PKG/usr/lib${LIBDIRSUFFIX}/python${PYV}/site-packages/_Hamlib.la
  145. rm -f $PKG/usr/lib${LIBDIRSUFFIX}/python${PYV}/site-packages/__pycache__/Hamlib.cpython-36.opt-1.pyc
  146. fi
  147. if [ x"${TCL_MOD}" = x"yes" ]; then
  148. rm -f $PKG/usr/lib${LIBDIRSUFFIX}/tcl${TCLV}/Hamlib/hamlibtcl.la
  149. fi
  150. if { [ x"${LUA_VER}" = x"5.2" ] || [ x"${LUA_VER}" = x"5.3" ]; } then
  151. rm -f $PKG/usr/lib${LIBDIRSUFFIX}/lua/${LUA_VER}/Hamliblua.la
  152. fi
  153. rm -f $PKG/usr/lib*/*.la
  154. mkdir -p $PKG/install
  155. cat $CWD/slack-desc > $PKG/install/slack-desc
  156. cd $PKG
  157. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE