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.

116 lines
3.0 KiB

13 years ago
13 years ago
13 years ago
13 years ago
13 years ago
13 years ago
13 years ago
13 years ago
13 years ago
13 years ago
13 years ago
13 years ago
13 years ago
13 years ago
13 years ago
13 years ago
13 years ago
13 years ago
  1. #!/bin/bash
  2. # Build script for Slackware
  3. # Copyright (C) 2008-2013,2015,2016,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 libebml sourcecode is available at: <http://www.matroska.org/>.
  26. # Source package infos
  27. NAMESRC=${NAMESRC:-libebml}
  28. VERSION=${VERSION:-1.3.10}
  29. ARCHIVE=${ARCHIVE:-$NAMESRC-$VERSION.tar.xz}
  30. WGET=${WGET:-http://dl.matroska.org/downloads/libebml/$ARCHIVE}
  31. # Built package infos
  32. NAMEPKG=${NAMEPKG:-libebml}
  33. BUILD=${BUILD:-1GGD}
  34. ARCH=${ARCH:-$(uname -m | sed 's/^i.86$/i486/;s/^arm.*/arm/')}
  35. JOBS=${JOBS:-1}
  36. EXT=${EXT:-txz}
  37. # Directories
  38. TMP=${TMP:-/tmp}
  39. OUT=${OUT:-$TMP/build}
  40. PKG=${PKG:-$OUT/$NAMEPKG}
  41. CWD=$(pwd)
  42. set -e # Quit if a command returns non-zero
  43. # Sanity checks
  44. if [ $UID -eq 0 ]; then
  45. echo "You should NOT run this script as ROOT!"
  46. exit 1
  47. fi
  48. if [ ! -d $TMP ]; then
  49. echo "$TMP does not exist or is not a directory!"
  50. exit 1
  51. fi
  52. # Compilation flags
  53. LIBDIRSUFFIX=""
  54. case "$ARCH" in
  55. i?86)
  56. CPUOPT="-O2 -march=$ARCH -mtune=i686"
  57. ;;
  58. x86_64)
  59. CPUOPT="-O2 -fPIC"
  60. LIBDIRSUFFIX="64"
  61. ;;
  62. *)
  63. CPUOPT="-O2"
  64. ;;
  65. esac
  66. # Get and verify the source archive
  67. if [ ! -r $ARCHIVE ]; then
  68. wget -c -O $ARCHIVE.part "$WGET"
  69. mv $ARCHIVE.part $ARCHIVE
  70. fi
  71. sha256sum -c $ARCHIVE.sha256
  72. NAME=$(tar ft $ARCHIVE | head -n 1 | cut -d / -f 1)
  73. # Compile
  74. cd $TMP
  75. echo "Building $ARCHIVE..."
  76. tar xf $CWD/$ARCHIVE
  77. cd $NAME
  78. mkdir build && cd build
  79. CFLAGS=$CPUOPT \
  80. CXXFLAGS=$CPUOPT \
  81. cmake \
  82. -DCMAKE_INSTALL_PREFIX=/usr \
  83. -DBUILD_SHARED_LIBS=yes \
  84. ..
  85. make -j $JOBS
  86. make install/strip DESTDIR=$PKG
  87. # Install the documentation
  88. mkdir -p $PKG/usr/doc/$NAME
  89. install -m 644 ../ChangeLog ../LICENSE.LGPL ../README.md $PKG/usr/doc/$NAME
  90. # Copy slack-desc file
  91. install -D -m 644 $CWD/slack-desc $PKG/install/slack-desc
  92. # Package the tree
  93. cd $PKG
  94. mkdir -p $OUT
  95. PACKAGING="
  96. chown root:root . -R
  97. /sbin/makepkg -l y -c n $OUT/$NAMEPKG-$VERSION-$ARCH-$BUILD.$EXT
  98. rm -rf $PKG
  99. rm -rf $TMP/$NAME
  100. "
  101. if type -p fakeroot ; then
  102. echo "$PACKAGING" | fakeroot
  103. else
  104. su -c "$PACKAGING"
  105. fi