recode.SlackBuild 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. #!/bin/bash
  2. # Copyright (c) 2007 Niki Kovacs <contact@kikinovak.net>
  3. # Copyright 2014 Ryan P.C. McQuen, WA, <ryanpcmcquen@member.fsf.org>
  4. #
  5. # Slackware build script for recode
  6. # Modified by Robby Workman <rworkman@slackbuilds.org>
  7. # Further small mods by Richard Hoyle <hoyle.richard@gmail.com>
  8. # Updating and testing for Slackware (including x86_64 and Multilib)
  9. # previously by Chris Abela <kristofru@gmail.com>
  10. # Now by Ryan P.C. McQuen
  11. # All rights reserved.
  12. #
  13. # Redistribution and use of this script, with or without modification, is
  14. # permitted provided that the following conditions are met:
  15. #
  16. # 1. Redistributions of this script must retain the above copyright
  17. # notice, this list of conditions and the following disclaimer.
  18. #
  19. # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR IMPLIED
  20. # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  21. # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
  22. # EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  23. # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  24. # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  25. # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  26. # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  27. # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  28. # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  29. # 20220412 bkw: Modified by SlackBuilds.org, BUILD=4:
  30. # - use correct github URL.
  31. # - strip binary and library.
  32. # - remove useless ABOUT-NLS from doc dir.
  33. cd $(dirname $0) ; CWD=$(pwd)
  34. PRGNAM=recode
  35. SRCNAM=Recode
  36. VERSION=${VERSION:-3.7_beta2}
  37. SRCVER=$(echo $VERSION | tr _ -)
  38. BUILD=${BUILD:-4}
  39. TAG=${TAG:-_SBo}
  40. PKGTYPE=${PKGTYPE:-tgz}
  41. if [ -z "$ARCH" ]; then
  42. case "$( uname -m )" in
  43. i?86) ARCH=i586 ;;
  44. arm*) ARCH=arm ;;
  45. *) ARCH=$( uname -m ) ;;
  46. esac
  47. fi
  48. # If the variable PRINT_PACKAGE_NAME is set, then this script will report what
  49. # the name of the created package would be, and then exit. This information
  50. # could be useful to other scripts.
  51. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  52. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  53. exit 0
  54. fi
  55. TMP=${TMP:-/tmp/SBo}
  56. PKG=$TMP/package-$PRGNAM
  57. OUTPUT=${OUTPUT:-/tmp}
  58. if [ "$ARCH" = "i586" ]; then
  59. SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  60. LIBDIRSUFFIX=""
  61. elif [ "$ARCH" = "i686" ]; then
  62. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  63. LIBDIRSUFFIX=""
  64. elif [ "$ARCH" = "x86_64" ]; then
  65. SLKCFLAGS="-O2 -fPIC"
  66. LIBDIRSUFFIX="64"
  67. else
  68. SLKCFLAGS="-O2"
  69. LIBDIRSUFFIX=""
  70. fi
  71. set -e
  72. rm -rf $PKG
  73. mkdir -p $TMP $PKG $OUTPUT
  74. cd $TMP
  75. rm -rf $SRCNAM-$SRCVER
  76. tar xvf $CWD/$SRCNAM-$SRCVER.tar.gz || tar xvf $CWD/v$SRCVER.tar.gz
  77. cd $SRCNAM-$SRCVER
  78. chown -R root:root .
  79. find -L . \
  80. \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
  81. -o -perm 511 \) -exec chmod 755 {} \+ -o \
  82. \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
  83. -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \+
  84. # allow recode to be built on a gcc that is not ancient -ryan
  85. sed -i "s/bool ignore : 2;/bool ignore : 1;/g" ./src/recodext.h
  86. # libdir and target are critical for x86_64
  87. CFLAGS="$SLKCFLAGS" \
  88. CXXFLAGS="$SLKCFLAGS" \
  89. ./configure \
  90. --prefix=/usr \
  91. --enable-static=no \
  92. --infodir=/usr/info \
  93. --mandir=/usr/man \
  94. --libdir=/usr/lib${LIBDIRSUFFIX} \
  95. --build=$ARCH-slackware-linux \
  96. --host=$ARCH-slackware-linux \
  97. --target=$ARCH-slackware-linux
  98. make
  99. make install-strip DESTDIR=$PKG
  100. gzip -9 $PKG/usr/man/man*/*
  101. rm -f $PKG/usr/info/dir
  102. gzip -9 $PKG/usr/info/*.info*
  103. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  104. cp -a AUTHORS COPYING* NEWS README THANKS TODO \
  105. $PKG/usr/doc/$PRGNAM-$VERSION
  106. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  107. rm -f $PKG/usr/lib*/*.la
  108. mkdir -p $PKG/install
  109. cat $CWD/slack-desc > $PKG/install/slack-desc
  110. cd $PKG
  111. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE