qt-creator.SlackBuild 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. #!/bin/bash
  2. # Slackware build script for Qt Creator
  3. # Copyright 2016 Andre Barboza, Belo Horizonte - Brazil
  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. # For building -rc or -beta releases, set VERSION to something like:
  24. # VERSION=4.2.0_rc1 or VERSION=4.2.0_beta1 (note the underscore).
  25. cd $(dirname $0) ; CWD=$(pwd)
  26. PRGNAM=qt-creator
  27. VERSION=${VERSION:-5.0.3}
  28. SRCVER=$(echo $VERSION | tr _ -)
  29. BUILD=${BUILD:-1}
  30. TAG=${TAG:-_SBo}
  31. PKGTYPE=${PKGTYPE:-tgz}
  32. if [ -z "$ARCH" ]; then
  33. case "$( uname -m )" in
  34. i?86) ARCH=i586 ;;
  35. arm*) ARCH=arm ;;
  36. *) ARCH=$( uname -m ) ;;
  37. esac
  38. fi
  39. # If the variable PRINT_PACKAGE_NAME is set, then this script will report what
  40. # the name of the created package would be, and then exit. This information
  41. # could be useful to other scripts.
  42. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  43. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  44. exit 0
  45. fi
  46. TMP=${TMP:-/tmp/SBo}
  47. PKG=$TMP/package-$PRGNAM
  48. OUTPUT=${OUTPUT:-/tmp}
  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-$SRCVER
  67. tar xvf $CWD/$PRGNAM-opensource-src-$SRCVER.tar.gz
  68. #mv $PRGNAM-opensource-src-$SRCVER $PRGNAM-$SRCVER
  69. cd $PRGNAM-$SRCVER
  70. chown -R root:root .
  71. chmod -R a-st,u+rwX,go-w+rX .
  72. # Adjust docs location.
  73. sed -i "s|share/doc/qtcreator|doc/$PRGNAM-$VERSION|g" qtcreator.pri || exit 1
  74. sed -i "s|share/doc/qtcreator|doc/$PRGNAM-$VERSION|g" doc/qtcreatordev/src/qtcreator-documentation.qdoc || exit 1
  75. sed -i "s|share/doc/\${IDE_ID}|doc/$PRGNAM-$VERSION|g" cmake/QtCreatorAPI.cmake || exit 1
  76. # LLVM/Clang can be used to extend Qt Creator functionality.
  77. if [ "${USE_LLVM:-no}" = yes ] || [ "${CODE_MODEL:-no}" = "yes" ]; then
  78. LLVM_INSTALL_ROOT=/usr/libexec/qtcreator/clang
  79. QMAKE_LFLAGS=-L${LLVM_INSTALL_ROOT}/lib
  80. export QTC_ENABLE_CLANG_LIBTOOLING=1
  81. if [ ! -x ${LLVM_INSTALL_ROOT}/bin/clang ]; then
  82. echo "error: You must install \"qt-creator-llvm\" package in order to"
  83. echo "error: use LLVM/Clang tools integration."
  84. exit 1
  85. fi
  86. fi
  87. # -Wunguarded-availability-new is not supported.
  88. patch -p0 < $CWD/remove-w-error-unguarded-availability-new.patch
  89. # Tell DEs that Qt Creator supports some more MIME types.
  90. patch -p0 < $CWD/add-mime-types.patch
  91. # Fix for https://lists.qt-project.org/pipermail/qt-creator/2019-May/008050.html
  92. QMAKE_LFLAGS="$QMAKE_LFLAGS -L/usr/lib$LIBDIRSUFFIX"
  93. qmake-qt5 -r qtcreator.pro \
  94. QMAKE_CXXFLAGS="$SLKCFLAGS" \
  95. QMAKE_LFLAGS="$QMAKE_LFLAGS" \
  96. QTC_PREFIX=/usr \
  97. IDE_LIBRARY_BASENAME=lib$LIBDIRSUFFIX \
  98. LLVM_INSTALL_DIR=$LLVM_INSTALL_ROOT \
  99. QBS_INSTALL_DIR=/usr \
  100. DEFINES+=QBS_ENABLE_PROJECT_FILE_UPDATES
  101. make
  102. make install INSTALL_ROOT=$PKG
  103. if which qdoc-qt5 &>/dev/null; then
  104. make docs
  105. make install_docs INSTALL_ROOT=$PKG
  106. else
  107. echo "qdoc-qt5 not found. Docs won't be built nor installed."
  108. fi
  109. find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
  110. | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
  111. mkdir -p $PKG/usr/share/mime/packages
  112. cat $CWD/qt-creator.xml > $PKG/usr/share/mime/packages/qt-creator.xml
  113. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  114. cp -a HACKING LICENSE.GPL3-EXCEPT README.md $PKG/usr/doc/$PRGNAM-$VERSION
  115. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  116. mkdir -p $PKG/install
  117. cat $CWD/slack-desc > $PKG/install/slack-desc
  118. cat $CWD/doinst.sh > $PKG/install/doinst.sh
  119. cd $PKG
  120. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE