qbs.SlackBuild 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. #!/bin/bash
  2. # Slackware build script for Qbs
  3. # Copyright 2014-2017 Nikos Giotis <nikos.giotis@mail.com>
  4. # Copyright 2020 Andrzej Telszewski, Szczecin
  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. cd $(dirname $0) ; CWD=$(pwd)
  24. PRGNAM=qbs
  25. VERSION=${VERSION:-1.16.0}
  26. BUILD=${BUILD:-1}
  27. TAG=${TAG:-_SBo}
  28. PKGTYPE=${PKGTYPE:-tgz}
  29. if [ -z "$ARCH" ]; then
  30. case "$( uname -m )" in
  31. i?86) ARCH=i586 ;;
  32. arm*) ARCH=arm ;;
  33. *) ARCH=$( uname -m ) ;;
  34. esac
  35. fi
  36. # If the variable PRINT_PACKAGE_NAME is set, then this script will report what
  37. # the name of the created package would be, and then exit. This information
  38. # could be useful to other scripts.
  39. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  40. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  41. exit 0
  42. fi
  43. TMP=${TMP:-/tmp/SBo}
  44. PKG=$TMP/package-$PRGNAM
  45. OUTPUT=${OUTPUT:-/tmp}
  46. if [ "$ARCH" = "i586" ]; then
  47. SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  48. LIBDIRSUFFIX=""
  49. elif [ "$ARCH" = "i686" ]; then
  50. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  51. LIBDIRSUFFIX=""
  52. elif [ "$ARCH" = "x86_64" ]; then
  53. SLKCFLAGS="-O2 -fPIC"
  54. LIBDIRSUFFIX="64"
  55. else
  56. SLKCFLAGS="-O2"
  57. LIBDIRSUFFIX=""
  58. fi
  59. set -e
  60. if which qbs &>/dev/null; then
  61. echo "Found \"qbs\" in PATH."
  62. echo "Please remove any previous Qbs installations before continuing."
  63. exit 1
  64. fi
  65. rm -rf $PKG
  66. mkdir -p $TMP $PKG $OUTPUT
  67. cd $TMP
  68. rm -rf $PRGNAM-$VERSION
  69. tar xvf $CWD/$PRGNAM-src-$VERSION.tar.gz
  70. mv $PRGNAM-src-$VERSION $PRGNAM-$VERSION
  71. cd $PRGNAM-$VERSION
  72. chown -R root:root .
  73. chmod -R a-st,u+rwX,go-w+rX .
  74. # Fix for missing *projectgeneratormanager.h*.
  75. patch -p0 < $CWD/corelib-tools.pri.patch
  76. # Adjust docs location.
  77. sed -i "s|share/doc/qbs|doc/qbs-$VERSION|g" doc/doc.pri
  78. qmake-qt5 qbs.pro \
  79. QMAKE_CXXFLAGS="$SLKCFLAGS" \
  80. QBS_INSTALL_PREFIX=/usr \
  81. QBS_LIBRARY_DIRNAME=lib$LIBDIRSUFFIX \
  82. CONFIG+=qbs_enable_project_file_updates
  83. make
  84. make install INSTALL_ROOT=$PKG
  85. if which qdoc-qt5 &>/dev/null; then
  86. make docs
  87. make install_docs INSTALL_ROOT=$PKG
  88. else
  89. echo "qdoc-qt5 not found in PATH. Docs won't be built nor installed."
  90. fi
  91. find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
  92. | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
  93. mkdir -p $PKG/usr/man/man1
  94. mv $PKG/usr/share/man/man1/qbs.1 $PKG/usr/man/man1
  95. gzip -9 $PKG/usr/man/man1/qbs.1
  96. rm -r $PKG/usr/share/man
  97. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  98. cp -a CONTRIBUTING.md LGPL_EXCEPTION.txt LICENSE.GPL3-EXCEPT \
  99. LICENSE.{LGPLv21,LGPLv3} README.md $PKG/usr/doc/$PRGNAM-$VERSION
  100. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  101. mkdir -p $PKG/usr/share/applications
  102. cat $CWD/qbs-config-ui.desktop > $PKG/usr/share/applications/qbs-config-ui.desktop
  103. mkdir -p $PKG/install
  104. cat $CWD/slack-desc > $PKG/install/slack-desc
  105. cat $CWD/doinst.sh > $PKG/install/doinst.sh
  106. cd $PKG
  107. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE