Some SlackBuild scripts for Slackware.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

127 lines
3.3 KiB

  1. #!/bin/bash
  2. # Build script for Slackware
  3. # Copyright (C) 2012,2019,2020 Damien Goutte-Gattat
  4. #
  5. # Redistribution and use of this script, with or without modifications,
  6. # is permitted provided that the following conditions are met:
  7. #
  8. # 1. Redistributions of this script must retain the above copyright
  9. # notice, this list of conditions and the following disclaimer.
  10. #
  11. # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AS IS'' AND ANY EXPRESS OR
  12. # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  13. # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  14. # DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
  15. # INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  16. # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  17. # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  18. # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
  19. # STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
  20. # IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  21. # POSSIBILITY OF SUCH DAMAGE.
  22. #
  23. # Contact: Damien Goutte-Gattat <dgouttegattat@incenp.org>
  24. #
  25. # Latest liboauth sourcecode is available at:
  26. # <http://liboauth.sourceforge.net/>.
  27. # Source package infos
  28. NAMESRC=${NAMESRC:-liboauth}
  29. VERSION=${VERSION:-1.0.3}
  30. ARCHIVE=${ARCHIVE:-$NAMESRC-$VERSION.tar.gz}
  31. WGET=${WGET:-http://downloads.sourceforge.net/liboauth/$ARCHIVE}
  32. # Build infos
  33. NAMEPKG=${NAMEPKG:-liboauth}
  34. BUILD=${BUILD:-2GGD}
  35. ARCH=${ARCH:-$(uname -m | sed 's/^i.86$/i486/;s/^arm.*/arm/')}
  36. JOBS=${JOBS:-1}
  37. EXT=${EXT:-txz}
  38. # Directories
  39. TMP=${TMP:-/tmp}
  40. OUT=${OUT:-$TMP/build}
  41. PKG=${PKG:-$OUT/$NAMEPKG}
  42. CWD=$(pwd)
  43. set -e # Quit if a command returns non-zero
  44. # Sanity checks
  45. if [ $UID -eq 0 ]; then
  46. echo "You should NOT run this script as ROOT!"
  47. exit 1
  48. fi
  49. if [ ! -d $TMP ]; then
  50. echo "$TMP does not exists or is not a directory!"
  51. exit 1
  52. fi
  53. # Compilation flags
  54. LIBDIRSUFFIX=""
  55. case "$ARCH" in
  56. i?86)
  57. CPUOPT="-O2 -march=$ARCH -mtune=i686"
  58. ;;
  59. x86_64)
  60. CPUOPT="-O2 -fPIC"
  61. LIBDIRSUFFIX="64"
  62. ;;
  63. *)
  64. CPUOPT="-O2"
  65. ;;
  66. esac
  67. # Get and verify the source archive
  68. if [ ! -r $ARCHIVE ]; then
  69. wget -c -O $ARCHIVE.part "$WGET"
  70. mv $ARCHIVE.part $ARCHIVE
  71. fi
  72. sha256sum -c $ARCHIVE.sha256
  73. NAME=$(tar ft $ARCHIVE | head -n 1 | cut -d / -f 1)
  74. # Compile
  75. cd $TMP
  76. echo "Building $ARCHIVE..."
  77. tar xf $CWD/$ARCHIVE
  78. cd $NAME
  79. # Apply patch from LFS to build against recent OpenSSL
  80. # <http://www.linuxfromscratch.org/patches/blfs/svn/liboauth-1.0.3-openssl-1.1.0-3.patch>
  81. patch -p 1 < $CWD/liboauth-1.0.3-openssl-1.1.0-3.patch
  82. CFLAGS=$CPUOPT \
  83. CXXFLAGS=$CPUOPT \
  84. ./configure \
  85. --prefix=/usr \
  86. --libdir=/usr/lib$LIBDIRSUFFIX \
  87. --mandir=/usr/man \
  88. --disable-static
  89. make -j $JOBS
  90. make install-strip DESTDIR=$PKG
  91. # Don't ship .la files
  92. rm -f $PKG/{,usr}/lib$LIBDIRSUFFIX/*.la
  93. # Compress man pages
  94. find $PKG/usr/man -type f -exec gzip -9 {} \;
  95. # Install the documentation
  96. mkdir -p $PKG/usr/doc/$NAME
  97. install -m 644 AUTHORS COPYING{,.GPL,.MIT} ChangeLog README \
  98. $PKG/usr/doc/$NAME
  99. # Copy slack-desc file
  100. install -D -m 644 $CWD/slack-desc $PKG/install/slack-desc
  101. # Package the tree
  102. cd $PKG
  103. mkdir -p $OUT
  104. PACKAGING="
  105. chown root:root . -R
  106. /sbin/makepkg -l y -c n $OUT/$NAMEPKG-$VERSION-$ARCH-$BUILD.$EXT
  107. rm -rf $PKG
  108. rm -rf $TMP/$NAME
  109. "
  110. if type -p fakeroot ; then
  111. echo "$PACKAGING" | fakeroot
  112. else
  113. su -c "$PACKAGING"
  114. fi