gmic.SlackBuild 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. #!/bin/bash
  2. # Copyright 2019 Giorgio Peron <giorgio.peron@gmail.com>, Belluno, Italy
  3. # All rights reserved.
  4. #
  5. # Redistribution and use of this script, with or without modification, is
  6. # 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 IMPLIED
  12. # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  13. # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
  14. # EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  15. # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  16. # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  17. # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  18. # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  19. # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  20. # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  21. cd $(dirname $0) ; CWD=$(pwd)
  22. PRGNAM=gmic
  23. VERSION=${VERSION:-2.9.4}
  24. COMMUNITYVERSION=${COMMUNITYVERSION:-6e9a20ef40e1db99c9b761853ad493ee7439e1b7}
  25. BUILD=${BUILD:-1}
  26. TAG=${TAG:-_SBo}
  27. PKGTYPE=${PKGTYPE:-tgz}
  28. if [ -z "$ARCH" ]; then
  29. case "$( uname -m )" in
  30. i?86) ARCH=i586 ;;
  31. arm*) ARCH=arm ;;
  32. *) ARCH=$( uname -m ) ;;
  33. esac
  34. fi
  35. # If the variable PRINT_PACKAGE_NAME is set, then this script will report what
  36. # the name of the created package would be, and then exit. This information
  37. # could be useful to other scripts.
  38. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  39. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  40. exit 0
  41. fi
  42. TMP=${TMP:-/tmp/SBo}
  43. PKG=$TMP/package-$PRGNAM
  44. OUTPUT=${OUTPUT:-/tmp}
  45. if [ "$ARCH" = "i586" ]; then
  46. SLKCFLAGS="-O0 -march=i586 -mtune=i686 -fno-fast-math"
  47. LIBDIRSUFFIX=""
  48. elif [ "$ARCH" = "i686" ]; then
  49. SLKCFLAGS="-O0 -march=i686 -mtune=i686 -fno-fast-math"
  50. LIBDIRSUFFIX=""
  51. elif [ "$ARCH" = "x86_64" ]; then
  52. SLKCFLAGS="-O2 -fPIC"
  53. LIBDIRSUFFIX="64"
  54. else
  55. SLKCFLAGS="-O0 -fno-fast-math"
  56. LIBDIRSUFFIX=""
  57. fi
  58. set -e
  59. rm -rf $PKG
  60. mkdir -p $TMP $PKG
  61. cd $TMP
  62. rm -rf $PRGNAM
  63. rm -rf $PRGNAM-community
  64. rm -rf $PRGNAM-qt
  65. tar xvf $CWD/$PRGNAM\_$VERSION.tar.gz --warning=no-unknown-keyword
  66. mv $PRGNAM-$VERSION $PRGNAM
  67. unzip $CWD/$PRGNAM-community-$COMMUNITYVERSION.zip || unzip $CWD/$COMMUNITYVERSION
  68. mv $PRGNAM-community-$COMMUNITYVERSION $PRGNAM-community
  69. cd $PRGNAM
  70. chown -R root:root .
  71. find -L . \
  72. \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
  73. -o -perm 511 \) -exec chmod 755 {} \; -o \
  74. \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
  75. -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
  76. sed -i -e "s|LIB = lib|LIB = lib$LIBDIRSUFFIX|g" \
  77. -e "s|/share/man/|/man/|g" \
  78. -e "s|/etc/bash_completion.d|/usr/share/bash-completion/completions|g" \
  79. -e "s|pkg-config opencv|pkg-config opencv4|" \
  80. -e "s|qmake|qmake-qt5|g" \
  81. src/Makefile || exit 1
  82. sed -i -e "s|-Ofast|-O2 -fno-fast-math --std=c++11|g" \
  83. gmic-qt/gmic_qt.pro || exit 1
  84. make -C src cli lib libc WGET=/bin/true LIBS=${LDFLAGS} OPT_CFLAGS="$SLKCFLAGS "
  85. cd gmic-qt
  86. qmake-qt5 GMIC_PATH=../src GMIC_DYNAMIC_LINKING=on HOST=none
  87. make
  88. qmake-qt5 GMIC_PATH=../src GMIC_DYNAMIC_LINKING=on HOST=gimp
  89. make
  90. qmake-qt5 GMIC_PATH=../src GMIC_DYNAMIC_LINKING=on HOST=krita
  91. make
  92. cd ../zart
  93. qmake-qt5 GMIC_PATH=../src GMIC_DYNAMIC_LINKING=off QMAKE_CXXFLAGS+=" -DOPENCV2_HEADERS"
  94. make
  95. cd ..
  96. make -C src install LIB=lib$LIBDIRSUFFIX DESTDIR="$PKG" USR="/usr"
  97. rmdir $PKG/usr/share || true
  98. find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
  99. | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
  100. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  101. cp -a COPYING* README* $PKG/usr/doc/$PRGNAM-$VERSION
  102. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  103. mkdir -p $PKG/install
  104. cat $CWD/slack-desc > $PKG/install/slack-desc
  105. cd $PKG
  106. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE