kdiff3.SlackBuild 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. #!/bin/bash
  2. # Slackware build script for: kdiff3
  3. # Copyright 2007-2011 Michiel van Wessem, Manchester, United Kingdom
  4. # Copyright (c) 2017 Ricardo J. Barberis <ricardo.barberis@gmail.com>
  5. # All rights reserved.
  6. #
  7. # QT4ONLY option courtesy of Ekin Akoglu, adapted by Ricardo J. Barberis
  8. #
  9. # Redistribution and use of this script, with or without modification, is
  10. # permitted provided that the following conditions are met:
  11. #
  12. # 1. Redistributions of this script must retain the above copyright
  13. # notice, this list of conditions and the following disclaimer.
  14. #
  15. # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR IMPLIED
  16. # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  17. # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
  18. # EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  19. # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  20. # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  21. # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  22. # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  23. # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  24. # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  25. cd $(dirname $0) ; CWD=$(pwd)
  26. PRGNAM=kdiff3
  27. VERSION=${VERSION:-1.9.3}
  28. BUILD=${BUILD:-1}
  29. TAG=${TAG:-_SBo}
  30. PKGTYPE=${PKGTYPE:-tgz}
  31. if [ -z "$ARCH" ]; then
  32. case "$( uname -m )" in
  33. i?86) ARCH=i586 ;;
  34. arm*) ARCH=arm ;;
  35. *) ARCH=$( uname -m ) ;;
  36. esac
  37. fi
  38. # If the variable PRINT_PACKAGE_NAME is set, then this script will report what
  39. # the name of the created package would be, and then exit. This information
  40. # could be useful to other scripts.
  41. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  42. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  43. exit 0
  44. fi
  45. TMP=${TMP:-/tmp/SBo}
  46. PKG=$TMP/package-$PRGNAM
  47. OUTPUT=${OUTPUT:-/tmp}
  48. QT4ONLY=${QT4ONLY:-no}
  49. if [ "$ARCH" = "i586" ]; then
  50. SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  51. LIBDIRSUFFIX=""
  52. elif [ "$ARCH" = "i686" ]; then
  53. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  54. LIBDIRSUFFIX=""
  55. elif [ "$ARCH" = "x86_64" ]; then
  56. SLKCFLAGS="-O2 -fPIC"
  57. LIBDIRSUFFIX="64"
  58. else
  59. SLKCFLAGS="-O2"
  60. LIBDIRSUFFIX=""
  61. fi
  62. set -e
  63. rm -rf $PKG
  64. mkdir -p $TMP $PKG $OUTPUT
  65. cd $TMP
  66. rm -rf $PRGNAM-$VERSION
  67. tar -xvf $CWD/$PRGNAM-$VERSION.tar.xz
  68. cd $PRGNAM-$VERSION
  69. chown -R root:root .
  70. find -L . \
  71. \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 -o -perm 511 \) \
  72. -exec chmod 755 {} \; -o \
  73. \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
  74. -exec chmod 644 {} \;
  75. if [ "${QT4ONLY}" == "no" ] ; then
  76. mkdir build
  77. cd build
  78. cmake \
  79. -DCMAKE_C_FLAGS:STRING="$SLKCFLAGS" \
  80. -DCMAKE_CXX_FLAGS:STRING="$SLKCFLAGS" \
  81. -DCMAKE_INSTALL_PREFIX=/usr \
  82. -DLIB_SUFFIX=${LIBDIRSUFFIX} \
  83. -DMAN_INSTALL_DIR=/usr/man \
  84. -DCMAKE_BUILD_TYPE=Release ..
  85. make VERBOSE=1
  86. make install VERBOSE=1 DESTDIR=$PKG
  87. cd ..
  88. else
  89. sed -i 's/%i -caption "%c"//g' src-QT4/kdiff3.desktop
  90. mkdir releaseQt
  91. cd releaseQt
  92. CFLAGS="$SLKCFLAGS" \
  93. CXXFLAGS="$SLKCFLAGS" \
  94. qmake ../src-QT4/kdiff3.pro
  95. sed -i "s,/usr/local,$PKG/usr,g" Makefile
  96. make VERBOSE=1
  97. make install VERBOSE=1 #INSTALL_ROOT=$PKG
  98. cd ../po
  99. for i in `ls` ; do
  100. if [ -s $i/kdiff3.po ]; then
  101. mkdir -p $PKG/usr/share/locale/$i/LC_MESSAGES
  102. fi
  103. done
  104. mkdir -p $PKG/usr/share/locale
  105. sed -i -e "s,/usr/share/locale/,$PKG/usr/share/locale/," create_qm_files
  106. sh create_qm_files install
  107. cd ..
  108. mkdir -p $PKG/usr/share/{applications,icons,pixmaps}
  109. cp -a src-QT4/kdiff3.desktop $PKG/usr/share/applications
  110. cp -a src-QT4/hi32-app-kdiff3.png $PKG/usr/share/pixmaps/kdiff3.png
  111. mkdir -p $PKG/usr/share/icons/hicolor/16x16
  112. mkdir $PKG/usr/share/icons/hicolor/32x32
  113. mkdir -p $PKG/usr/share/icons/locolor/16x16
  114. mkdir $PKG/usr/share/icons/locolor/32x32
  115. cp -a src-QT4/hi16-app-kdiff3.png $PKG/usr/share/icons/hicolor/16x16
  116. cp -a src-QT4/hi32-app-kdiff3.png $PKG/usr/share/icons/hicolor/32x32
  117. cp -a src-QT4/lo16-app-kdiff3.png $PKG/usr/share/icons/locolor/16x16
  118. cp -a src-QT4/lo32-app-kdiff3.png $PKG/usr/share/icons/locolor/32x32
  119. fi
  120. find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \
  121. | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
  122. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  123. cp -a AUTHORS COPYING ChangeLog INSTALL README doc \
  124. $PKG/usr/doc/$PRGNAM-$VERSION
  125. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  126. find $PKG/usr/doc/$PRGNAM-$VERSION -type f -exec chmod 644 {} \;
  127. mkdir $PKG/install
  128. cat $CWD/slack-desc > $PKG/install/slack-desc
  129. cat $CWD/doinst.sh > $PKG/install/doinst.sh
  130. cd $PKG
  131. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE