mdbtools.SlackBuild 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. #!/bin/bash
  2. # Slackware build script for mdbtools
  3. # Copyright 2008 Hans Goossen <goosseno@gmail.com>
  4. # Copyright 2022 Juan M. Lasca <juanmlasca@gmail.com>
  5. # All rights reserved.
  6. #
  7. # Redistribution and use of this script, with or without modification, is
  8. # permitted provided that the following conditions are met:
  9. #
  10. # 1. Redistributions of this script must retain the above copyright
  11. # notice, this list of conditions and the following disclaimer.
  12. #
  13. # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR IMPLIED
  14. # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  15. # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
  16. # EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  17. # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  18. # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  19. # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  20. # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  21. # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  22. # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  23. # 20220217 bkw: Modified by SlackBuilds.org:
  24. # - fix build on 15.0.
  25. # - remove .la files.
  26. # 20221804 Modified by Juan M. Lasca:
  27. # - update to version 1.0.0
  28. # - include bash completions
  29. # - add option to build iodbc or unixodbc driver if installed
  30. # - add option to include debugging tools
  31. cd $(dirname $0) ; CWD=$(pwd)
  32. PRGNAM=mdbtools
  33. VERSION=${VERSION:-1.0.0}
  34. BUILD=${BUILD:-1}
  35. TAG=${TAG:-_SBo}
  36. PKGTYPE=${PKGTYPE:-tgz}
  37. if [ -z "$ARCH" ]; then
  38. case "$( uname -m )" in
  39. i?86) ARCH=i586 ;;
  40. arm*) ARCH=arm ;;
  41. *) ARCH=$( uname -m ) ;;
  42. esac
  43. fi
  44. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  45. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  46. exit 0
  47. fi
  48. TMP=${TMP:-/tmp/SBo}
  49. PKG=$TMP/package-$PRGNAM
  50. OUTPUT=${OUTPUT:-/tmp}
  51. if [ "$ARCH" = "i586" ]; then
  52. SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  53. LIBDIRSUFFIX=""
  54. elif [ "$ARCH" = "i686" ]; then
  55. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  56. LIBDIRSUFFIX=""
  57. elif [ "$ARCH" = "x86_64" ]; then
  58. SLKCFLAGS="-O2 -fPIC"
  59. LIBDIRSUFFIX="64"
  60. else
  61. SLKCFLAGS="-O2"
  62. LIBDIRSUFFIX=""
  63. fi
  64. set -e
  65. rm -rf $PKG
  66. mkdir -p $TMP $PKG $OUTPUT
  67. cd $TMP
  68. rm -rf $PRGNAM-$VERSION
  69. tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
  70. cd $PRGNAM-$VERSION
  71. chown -R root:root .
  72. find -L . \
  73. \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
  74. -o -perm 511 \) -exec chmod 755 {} \; -o \
  75. \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
  76. -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
  77. with_odbc="";
  78. [ -f /usr/lib${LIBDIRSUFFIX}/libiodbc.so ] && [ "${UNIXODBC_DRIVER:-yes}" = "no" ] &&
  79. with_odbc="--with-iodbc=/usr";
  80. [ -f /usr/lib${LIBDIRSUFFIX}/libodbc.so ] && [ "${UNIXODBC_DRIVER:-yes}" != "no" ] &&
  81. with_odbc="--with-unixodbc=/usr";
  82. CFLAGS="$SLKCFLAGS" \
  83. CXXFLAGS="$SLKCFLAGS" \
  84. ./configure \
  85. --prefix=/usr \
  86. --libdir=/usr/lib${LIBDIRSUFFIX} \
  87. --sysconfdir=/etc \
  88. --localstatedir=/var \
  89. --mandir=/usr/man \
  90. --docdir=/usr/doc/$PRGNAM-$VERSION \
  91. --enable-static=no \
  92. --enable-shared=yes \
  93. $with_odbc \
  94. --with-bash-completion-dir=/usr/share/bash-completion/completions \
  95. --build=$ARCH-slackware-linux
  96. make
  97. make install DESTDIR=$PKG
  98. # Does the user wants the debugging tools?
  99. if [ "${DEBUGGING_TOOLS:-yes}" != "no" ]; then
  100. for i in $( find src/util/.libs/ \! -name "mdb-*" -a -type f -printf "%f\n" ); do
  101. mv src/util/.libs/$i $PKG/usr/bin/mdb-$i;
  102. done;
  103. fi;
  104. find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
  105. | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
  106. find $PKG/usr/man -type f -exec gzip -9 {} \;
  107. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  108. cp -a AUTHORS COPYING COPYING.LIB NEWS README.md HACKING.md $PKG/usr/doc/$PRGNAM-$VERSION
  109. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  110. rm -f $PKG/{,usr/}lib${LIBDIRSUFFIX}/*.la
  111. mkdir -p $PKG/install
  112. cat $CWD/slack-desc > $PKG/install/slack-desc
  113. cd $PKG
  114. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE