File indexing completed on 2024-04-28 12:39:34
0001 #!/bin/bash 0002 # This script can be used to build Kid3 together with static libraries for the 0003 # Windows and Mac versions of Kid3. Linux and BSD users do not need it because 0004 # the libraries can be installed from their repositories, but they can use it 0005 # to generate a self contained package with a minimum of dependencies. 0006 # 0007 # First you have to install the necessary tools: 0008 # 0009 # For Windows: 0010 # 0011 # Install Qt, you should use the MinGW which comes with Qt and add msys2 0012 # to build the libraries. Additional dependencies can be installed using 0013 # Chocolatey, e.g. 0014 # choco install cmake docbook-bundle ninja python3 Wget xsltproc yasm 0015 # Install additional packages in the MSYS2 MinGW 64-bit shell: 0016 # pacman -S git patch make autoconf automake nasm libtool 0017 # Start the msys shell, add Qt and cmake to the path and start this script. 0018 # 0019 # export QTPREFIX=/c/Qt/6.5.3/mingw_64 0020 # test -z "${PATH##$QTPREFIX*}" || 0021 # PATH=$QTPREFIX/bin:$QTPREFIX/../../Tools/mingw730_64/bin:$QTPREFIX/../../Tools/mingw730_64/opt/bin:$PROGRAMFILES/CMake/bin:$PATH 0022 # ../kid3/build.sh 0023 # 0024 # You can also build a Windows version from Linux using the MinGW cross 0025 # compiler. 0026 # COMPILER=cross-mingw QTPREFIX=/path/to/Qt6.5.3-mingw64/6.5.3/mingw_64 \ 0027 # QTBINARYDIR=/path/to/Qt6.5.3-linux/6.5.3/gcc_64/bin ../kid3/build.sh 0028 # 0029 # For Mac: 0030 # 0031 # The build dependencies can be installed with Homebrew, for instance: 0032 # brew install cmake ninja autoconf automake libtool xz nasm docbook-xsl qt 0033 # Then call from a build directory 0034 # ../kid3/build.sh 0035 # 0036 # You can also build a macOS version from Linux using the osxcross toolchain. 0037 # COMPILER=cross-macos QTPREFIX=/path/to/Qt6.5.3-mac/6.5.3/macos ../kid3/build.sh 0038 # or 0039 # COMPILER=cross-macos QTPREFIX=/path/to/Qt6.5.3-mac/6.5.3/macos \ 0040 # QTBINARYDIR=/path/to/Qt6.5.3-linux/6.5.3/gcc_64/bin ../kid3/build.sh 0041 # 0042 # For Android: 0043 # 0044 # Install Qt and a compatible Android SDK and NDK, for example Qt 5.9.7, 0045 # NDK 10e or Qt 5.12.2, NDK 19c, or Qt 6.5.3, NDK 23.1.7779620. 0046 # COMPILER=cross-android QTPREFIX=/path/to/Qt/6.5.3/android_armv7 \ 0047 # QTBINARYDIR=/path/to/Qt6.5.3-linux/6.5.3/gcc_64/bin \ 0048 # ANDROID_SDK_ROOT=/path/to/sdk ANDROID_NDK_ROOT=/path/to/ndk/23.1.7779620 \ 0049 # ../kid3/build.sh 0050 # 0051 # For Linux: 0052 # 0053 # To build a self-contained Linux package use 0054 # COMPILER=gcc-self-contained QTPREFIX=/path/to/Qt6.5.3-linux/6.5.3/gcc_64 \ 0055 # ../kid3/build.sh 0056 # 0057 # When cross compiling make sure that the host Qt version is not larger than 0058 # the target Qt version, otherwise moc and plugins will fail. To provide 0059 # host Qt binaries of a suitable version, set the QTBINARYDIR environment 0060 # variable. 0061 # 0062 # The source code for the libraries is downloaded from Debian and Ubuntu 0063 # repositories. If the files are no longer available, use a later version, 0064 # it should still work. 0065 # 0066 # build.sh will download, build and install zlib, libogg, libvorbis, 0067 # flac, id3lib, taglib, ffmpeg, chromaprint, mp4v2. When the libraries 0068 # are built, the Kid3 package is built. It is also possible to build only 0069 # the libraries or only the Kid3 package. 0070 # 0071 # ../kid3/build.sh libs 0072 # ../kid3/build.sh package 0073 0074 # Exit if an error occurs 0075 set -e 0076 shopt -s extglob 0077 0078 thisdir=$(pwd) 0079 srcdir=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) 0080 0081 kernel=$(uname) 0082 test ${kernel:0:5} = "MINGW" && kernel="MINGW" 0083 0084 verify_not_in_srcdir() { 0085 if test -f CMakeLists.txt; then 0086 echo "Do not run this script from the source directory!" 0087 echo "Start it from a build directory at the same level as the source directory." 0088 exit 1 0089 fi 0090 } 0091 0092 verify_in_srcdir() { 0093 if ! test -f CMakeLists.txt; then 0094 echo "Run this task from the source directory!" 0095 exit 1 0096 fi 0097 } 0098 0099 # Administrative subtasks 0100 0101 # Changes version and date strings in all known Kid3 files. 0102 if test "$1" = "changeversion"; then 0103 OLDVER=$2 0104 NEWVER=$3 0105 if test -z "$OLDVER" || test -z "$NEWVER"; then 0106 echo "Usage: $0 $1 old-version-nr new-version-nr [--finalize], e.g. $0 $1 0.8 0.9" 0107 exit 1 0108 fi 0109 0110 echo "### Change version and date strings" 0111 0112 DATE=$(LC_TIME=C date) 0113 DATE_R=$(date -R) 0114 DATE_F=$(date +"%F") 0115 DATE_Y=$(date +"%Y") 0116 0117 OLDMAJOR=$(echo $OLDVER | cut -f 1 -d .) 0118 OLDMINOR=$(echo $OLDVER | cut -f 2 -d .) 0119 OLDPATCH=$(echo $OLDVER | cut -f 3 -d .) 0120 test -z $OLDPATCH && OLDPATCH=0 0121 0122 NEWMAJOR=$(echo $NEWVER | cut -f 1 -d .) 0123 NEWMINOR=$(echo $NEWVER | cut -f 2 -d .) 0124 NEWPATCH=$(echo $NEWVER | cut -f 3 -d .) 0125 test -z $NEWPATCH && NEWPATCH=0 0126 0127 cd "$srcdir" 0128 grep -qF "kid3 (${NEWVER}-0)" deb/changelog || 0129 sed -i "1 i\ 0130 kid3 (${NEWVER}-0) unstable; urgency=low\n\n * New upstream release.\n\n\ 0131 -- Urs Fleisch <ufleisch@users.sourceforge.net> ${DATE_R}\n" deb/changelog 0132 grep -qF "<releaseinfo>${NEWVER}</releaseinfo>" doc/en/index.docbook || 0133 sed -i "s/^<releaseinfo>${OLDVER}<\/releaseinfo>$/<releaseinfo>${NEWVER}<\/releaseinfo>/; s/^<year>[0-9]\+<\/year>$/<year>${DATE_Y}<\/year>/; s/^<date>[0-9-]\+<\/date>$/<date>${DATE_F}<\/date>/" doc/en/index.docbook 0134 sed -i "s/PROJECTVERSION=\"${OLDVER}\"/PROJECTVERSION=\"${NEWVER}\"/" translations/extract-merge.sh 0135 # kid3.spec is used by f-droid to detect a new version, it should be updated exactly before the release. 0136 if test "$4" = "--finalize"; then 0137 sed -i "s/^\(Version: \+\).*$/\1${NEWVER}/" kid3.spec 0138 OLDCODE=$(sed -n "s/ \+set(QT_ANDROID_APP_VERSION_CODE \([0-9]\+\))/\1/p" CMakeLists.txt) 0139 NEWCODE=$[ $OLDCODE + 1 ] 0140 sed -i "s/\( \+set(QT_ANDROID_APP_VERSION_CODE \)\([0-9]\+\))/\1$NEWCODE)/" CMakeLists.txt 0141 fi 0142 sed -i "s/^Copyright 2003-[0-9]\+ Urs Fleisch <ufleisch@users.sourceforge.net>$/Copyright 2003-${DATE_Y} Urs Fleisch <ufleisch@users.sourceforge.net>/" deb/copyright 0143 grep -qF "* Release ${NEWVER}" ChangeLog || 0144 sed -i "1 i\ 0145 ${DATE} Urs Fleisch <ufleisch@users.sourceforge.net>\n\n\t* Release ${NEWVER}\n" ChangeLog 0146 sed -i "s/PROJECT_NUMBER = ${OLDVER}/PROJECT_NUMBER = ${NEWVER}/" Doxyfile 0147 sed -i "s/set(CPACK_PACKAGE_VERSION_MAJOR ${OLDMAJOR})/set(CPACK_PACKAGE_VERSION_MAJOR ${NEWMAJOR})/; s/set(CPACK_PACKAGE_VERSION_MINOR ${OLDMINOR})/set(CPACK_PACKAGE_VERSION_MINOR ${NEWMINOR})/; s/set(CPACK_PACKAGE_VERSION_PATCH ${OLDPATCH})/set(CPACK_PACKAGE_VERSION_PATCH ${NEWPATCH})/; s/set(RELEASE_YEAR [0-9]\+)/set(RELEASE_YEAR ${DATE_Y})/" CMakeLists.txt 0148 grep -qF "<release version=\"${NEWVER}\"" src/app/org.kde.kid3.appdata.xml || 0149 sed -i "s,^ <releases>.*,&\n <release version=\"${NEWVER}\" date=\"${DATE_F}\"/>," src/app/org.kde.kid3.appdata.xml 0150 grep -q "for ver in .*'${NEWVER}'" packaging/craft/extragear/kid3/kid3.py || 0151 sed -i -r "s/(for ver in \[[^]]*'${OLDVER}')\]:/\1, '${NEWVER}']:/" packaging/craft/extragear/kid3/kid3.py 0152 sed -i "s,https://download.kde.org/stable/kid3/${OLDVER}/kid3-${OLDVER}.tar.xz,https://download.kde.org/stable/kid3/${NEWVER}/kid3-${NEWVER}.tar.xz," packaging/flatpak/org.kde.kid3-stable.json 0153 cd - >/dev/null 0154 exit 0 0155 fi # changeversion 0156 0157 if test "$1" = "cleanuppo"; then 0158 echo "### Clean up .po files" 0159 0160 for f in $srcdir/translations/po/*/*.po; do 0161 sed -i "/#, \(fuzzy, \)\?qt-\(plural-\)\?format/ d; /#, kde-format/ d; /^#~ msg/ d" $f 0162 done 0163 exit 0 0164 fi # cleanuppo 0165 0166 if test "$1" = "makearchive"; then 0167 VERSION=$2 0168 if test -z "$VERSION"; then 0169 VERSION=$(date +"%Y%m%d") 0170 fi 0171 0172 DIR=kid3-$VERSION 0173 TGZ=$DIR.tar.gz 0174 if test -e "$TGZ"; then 0175 echo "$TGZ already exists!" 0176 exit 1 0177 fi 0178 0179 cd $srcdir 0180 git archive --format=tar --prefix=$DIR/ HEAD | gzip >$thisdir/$TGZ 0181 cd - >/dev/null 0182 exit 0 0183 fi # makearchive 0184 0185 # Build a docker image to build binary Kid3 packages. 0186 # The docker image can then be started using "rundocker". 0187 # You can then build all packages using 0188 # kid3/build.sh rundocker $HOME/projects/kid3/src/build-all.sh 0189 # You need: 0190 # - Kid3 project checked out in ~/projects/kid3/src/kid3 0191 # - At least CMake 3.21 in /opt/cmake/bin/ 0192 # Linux: 0193 # - Qt 6.5.3 Linux in ~/Development/Qt6.5.3-linux/6.5.3/gcc_64/ 0194 # Windows: 0195 # - MinGW 11.2 cross compiler in /opt/mxe11/ 0196 # - Qt 6.5.3 MinGW64 in ~/Development/Qt6.5.3-mingw64/6.5.3/mingw_64/ 0197 # Mac: 0198 # - Mac cross compiler in /opt/osxcross/ 0199 # - Qt 6.5.3 Mac in ~/Development/Qt6.5.3-mac/6.5.3/macos/ 0200 # Android: 0201 # - Java JDK 17 0202 # - Android SDK in ~/Development/android-sdk/ 0203 # - Android NDK in ~/Development/android-sdk/ndk/23.1.7779620/ 0204 # - Qt 6.5.3 Android in ~/Development/Qt6.5.3-android/6.5.3/android_armv7/ 0205 # - Sign key in ~/Development/ufleisch-release-key.keystore 0206 # - Gradle cache in ~/.gradle/ 0207 if test "$1" = "makedocker"; then 0208 verify_not_in_srcdir 0209 if ! test -f build-all.sh; then 0210 cat >build-all.sh <<"EOF" 0211 #!/bin/bash 0212 cd "$(dirname "${BASH_SOURCE[0]}")" 0213 set -e 0214 (cd linux_build && \ 0215 PATH=/opt/cmake/bin:$PATH \ 0216 COMPILER=gcc-self-contained \ 0217 QTPREFIX=$HOME/Development/Qt6.5.3-linux/6.5.3/gcc_64 \ 0218 ../kid3/build.sh) 0219 (cd mingw64_build && \ 0220 PATH=/opt/mxe11/usr/bin:/opt/cmake/bin:$PATH \ 0221 COMPILER=cross-mingw \ 0222 QTPREFIX=$HOME/Development/Qt6.5.3-mingw64/6.5.3/mingw_64 \ 0223 QTBINARYDIR=$HOME/Development/Qt6.5.3-linux/6.5.3/gcc_64/bin \ 0224 ../kid3/build.sh) 0225 (cd macos_build && \ 0226 rm -f kid3/*-Darwin.dmg && \ 0227 PATH=/opt/cmake/bin:$PATH \ 0228 COMPILER=cross-macos \ 0229 QTPREFIX=$HOME/Development/Qt6.5.3-mac/6.5.3/macos \ 0230 OSXPREFIX=/opt/osxcross/target \ 0231 QTBINARYDIR=$HOME/Development/Qt6.5.3-linux/6.5.3/gcc_64/bin \ 0232 ../kid3/build.sh && \ 0233 fatdmg=(kid3/*-Darwin.dmg) && \ 0234 slimdmg=${fatdmg/-Darwin./-Darwin-amd64.} && \ 0235 PATH=$PATH:/opt/osxcross/target/bin \ 0236 ../kid3/macosx/mac-strip-arm64.sh $fatdmg $slimdmg) 0237 (cd macos_qt5_build && \ 0238 rm -f kid3/*-Darwin.dmg && \ 0239 COMPILER=cross-macos \ 0240 QTPREFIX=$HOME/Development/Qt5.15.2-mac/5.15.2/clang_64 \ 0241 OSXPREFIX=/opt/osxcross/target \ 0242 ../kid3/build.sh && \ 0243 origdmg=(kid3/*-Darwin.dmg) && \ 0244 qt5dmg=${origdmg/-Darwin./-Darwin-Qt5.} && \ 0245 mv $origdmg $qt5dmg) 0246 (cd android_build && \ 0247 PATH=/opt/cmake/bin:$PATH \ 0248 COMPILER=cross-android \ 0249 QTPREFIX=$HOME/Development/Qt6.5.3-android/6.5.3/android_armv7 \ 0250 QTBINARYDIR=$HOME/Development/Qt6.5.3-linux/6.5.3/gcc_64/bin \ 0251 JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64 \ 0252 ANDROID_SDK_ROOT=$HOME/Development/android-sdk \ 0253 ANDROID_NDK_ROOT=$ANDROID_SDK_ROOT/ndk/23.1.7779620 \ 0254 ../kid3/build.sh) 0255 EOF 0256 chmod +x build-all.sh 0257 fi 0258 mkdir -p docker_image_context 0259 cd docker_image_context 0260 echo "### Build docker image" 0261 UNAME=$(uname) 0262 if hash podman 2>/dev/null; then 0263 DOCKER=podman 0264 elif [ -z "${UNAME##MINGW*}" ] || [ -z "${UNAME##MSYS*}" ] || id -Gn | grep -qw "docker\(root\)\?"; then 0265 DOCKER=docker 0266 else 0267 DOCKER="sudo docker" 0268 fi 0269 $DOCKER build --build-arg USER=${USER} --build-arg UID=$(id -u) -t ufleisch/kid3dev:bullseye . -f-<<"EOF" 0270 FROM debian:bullseye-slim 0271 RUN apt-get update && apt-get install -y --no-install-recommends \ 0272 devscripts build-essential lintian debhelper extra-cmake-modules \ 0273 libkf5kio-dev libkf5doctools-dev qtmultimedia5-dev qtdeclarative5-dev \ 0274 qttools5-dev qttools5-dev-tools qtdeclarative5-dev-tools \ 0275 qml-module-qtquick2 cmake python libid3-3.8.3-dev libflac++-dev \ 0276 libvorbis-dev libtag1-dev libchromaprint-dev libavformat-dev \ 0277 libavcodec-dev docbook-xsl pkg-config libreadline-dev xsltproc \ 0278 debian-keyring dput-ng python3-distro-info sudo curl less \ 0279 locales ninja-build ccache p7zip-full genisoimage \ 0280 clang llvm nasm lib32z1 chrpath libpulse-mainloop-glib0 dmg2img archivemount \ 0281 openjdk-17-jre-headless libxcb-cursor0 libxrandr2 0282 ARG USER 0283 ARG UID 0284 RUN adduser --quiet --disabled-password --uid $UID --gecos "User" $USER && \ 0285 echo "$USER:$USER" | chpasswd && usermod -aG sudo $USER && \ 0286 locale-gen en_US.UTF-8 && \ 0287 mkdir -p /home/$USER/projects/kid3 /home/$USER/Development && \ 0288 ln -s /proc/self/mounts /etc/mtab 0289 USER $USER 0290 CMD bash 0291 EOF 0292 exit 0 0293 fi 0294 0295 # Run docker image created with "makedocker". 0296 if test "$1" = "rundocker"; then 0297 echo "### Run docker image" 0298 shift 0299 UNAME=$(uname) 0300 if hash podman 2>/dev/null; then 0301 DOCKER=podman 0302 USERNSARG=--userns=keep-id 0303 elif [ -z "${UNAME##MINGW*}" ] || [ -z "${UNAME##MSYS*}" ] || id -Gn | grep -qw "docker\(root\)\?"; then 0304 DOCKER=docker 0305 USERNSARG= 0306 else 0307 DOCKER="sudo docker" 0308 USERNSARG= 0309 fi 0310 $DOCKER run $USERNSARG --rm -it -e LANG=C.UTF-8 \ 0311 --device /dev/fuse --cap-add SYS_ADMIN \ 0312 -v $HOME/projects/kid3:$HOME/projects/kid3 \ 0313 -v $HOME/.gradle:$HOME/.gradle \ 0314 -v $HOME/.gnupg:$HOME/.gnupg:ro \ 0315 -v /opt/cmake:/opt/cmake:ro \ 0316 -v /opt/osxcross:/opt/osxcross:ro \ 0317 -v /opt/mxe11:/opt/mxe11:ro \ 0318 -v /opt/jdk8:/opt/jdk8:ro \ 0319 -v $HOME/Development:$HOME/Development:ro ufleisch/kid3dev:bullseye "$@" 0320 exit 0 0321 fi 0322 0323 # Build flatpak 0324 if test "$1" = "flatpak"; then 0325 verify_not_in_srcdir 0326 echo "### Build flatpak" 0327 flatpak-builder --sandbox --force-clean --ccache --repo=repo --subject="Build of org.kde.kid3 $(date --iso-8601=seconds)" app "$srcdir/packaging/flatpak/org.kde.kid3-local.json" 0328 exit 0 0329 fi 0330 0331 # Build Debian package. 0332 if test "$1" = "deb"; then 0333 verify_in_srcdir 0334 echo "### Build Debian package" 0335 shift 0336 test -d debian && rm -rf debian 0337 cp -R deb debian 0338 # The PPA version (e.g. trusty1) can be given as a parameter to prepare 0339 # a PPA upload. The source archive kid3_${version}.orig.tar.gz must be 0340 # in the parent directory. 0341 ppaversion=$1 0342 if test -n "$ppaversion"; then 0343 distribution=${ppaversion%%[0-9]*} 0344 else 0345 distribution=$(lsb_release -sc) 0346 fi 0347 0348 if test -n "$ppaversion"; then 0349 version=$(sed -e 's/^kid3 (\([0-9\.-]\+\).*$/\1/;q' debian/changelog) 0350 DEBEMAIL="Urs Fleisch <ufleisch@users.sourceforge.net>" \ 0351 dch --newversion=${version}${ppaversion} --distribution=$distribution --urgency=low \ 0352 "No-change backport to $distribution." 0353 sed -i -e 's/^Maintainer:.*$/Maintainer: Urs Fleisch <ufleisch@users.sourceforge.net>/;/^Uploaders:/,+1d' debian/control 0354 debuild -S -sa && 0355 echo "PPA upload ready for $distribution. Use:" && 0356 echo "cd ..; dput ppa:ufleisch/kid3 kid3_${version}${ppaversion}_source.changes" 0357 else 0358 rm -rf debian/source debian/watch 0359 debuild 0360 fi 0361 exit 0 0362 fi 0363 0364 # End of subtasks 0365 0366 verify_not_in_srcdir 0367 0368 target=${*:-libs package} 0369 0370 qt_version=6.5.3 0371 zlib_version=1.2.13 0372 zlib_patchlevel=3 0373 libogg_version=1.3.4 0374 libogg_patchlevel=0.1 0375 libvorbis_version=1.3.7 0376 libvorbis_patchlevel=1 0377 ffmpeg3_version=3.2.14 0378 ffmpeg3_patchlevel=1~deb9u1 0379 ffmpeg_version=5.1.3 0380 ffmpeg_patchlevel=1 0381 libflac_version=1.4.3+ds 0382 libflac_patchlevel=2 0383 id3lib_version=3.8.3 0384 id3lib_patchlevel=18 0385 taglib_version=2.0 0386 chromaprint_version=1.5.1 0387 chromaprint_patchlevel=4 0388 mp4v2_version=2.1.3 0389 utfcpp_version=4.0.5 0390 0391 # Try to find the configuration from an existing build. 0392 if test -z "$COMPILER"; then 0393 if test -f mingw.cmake; then 0394 COMPILER=cross-mingw 0395 QTPREFIX=$(sed -ne '1 s/set(QT_PREFIX \([^)]\+\))/\1/p' mingw.cmake) 0396 elif test -f osxcross.cmake; then 0397 COMPILER=cross-macos 0398 QTPREFIX=$(sed -ne '1 s/set(QT_PREFIX \([^)]\+\))/\1/p' osxcross.cmake) 0399 elif test $(ls openssl-*/Setenv-android.sh 2>/dev/null | wc -l) != "0"; then 0400 COMPILER=cross-android 0401 test -f kid3/CMakeCache.txt && 0402 QTPREFIX=$(sed -ne 's/^QT_QMAKE_EXECUTABLE[^=]*=\(.*\)\/bin\/qmake$/\1/p' kid3/CMakeCache.txt) 0403 elif grep -q "CMAKE_CXX_COMPILER.*g++-4\.8" kid3/CMakeCache.txt 2>/dev/null; then 0404 COMPILER=gcc-self-contained 0405 QTPREFIX=$(sed -ne 's/^QT_QMAKE_EXECUTABLE[^=]*=\(.*\)\/bin\/qmake$/\1/p' kid3/CMakeCache.txt) 0406 elif grep -q "^CMAKE_BUILD_TYPE.*=Debug$" kid3/CMakeCache.txt 2>/dev/null; then 0407 COMPILER=gcc-debug 0408 QTPREFIX=$(sed -ne 's/^QT_QMAKE_EXECUTABLE[^=]*=\(.*\)\/bin\/qmake$/\1/p' kid3/CMakeCache.txt) 0409 fi 0410 fi 0411 0412 compiler=${COMPILER:-gcc} 0413 echo -n "### Building $target with $compiler" 0414 if test -n "$QTPREFIX"; then 0415 echo -n " using $QTPREFIX" 0416 fi 0417 echo "." 0418 0419 if [[ "$QTPREFIX" =~ /([0-9]+)\.([0-9]+)\.([0-9]+)/ ]]; then 0420 qt_nr=$(printf "%d%02d%02d" ${BASH_REMATCH[1]} ${BASH_REMATCH[2]} ${BASH_REMATCH[3]}) 0421 qt_version=$(printf "%d.%d.%d" ${BASH_REMATCH[1]} ${BASH_REMATCH[2]} ${BASH_REMATCH[3]}) 0422 qt_version_major=${BASH_REMATCH[1]} 0423 else 0424 echo "Could not extract Qt version from $QTPREFIX, assuming $qt_version" 0425 if [[ "$qt_version" =~ ^([0-9]+)\.([0-9]+)\.([0-9]+)$ ]]; then 0426 qt_nr=$(printf "%d%02d%02d" ${BASH_REMATCH[1]} ${BASH_REMATCH[2]} ${BASH_REMATCH[3]}) 0427 qt_version_major=${BASH_REMATCH[1]} 0428 fi 0429 fi 0430 0431 if test "$compiler" = "cross-android" -o "$compiler" = "gcc-self-contained" && test "$qt_nr" -ge 60000; then 0432 openssl_version=3.0.9 0433 elif test "$qt_nr" -ge 51204; then 0434 # Since Qt 5.12.4, OpenSSL 1.1.1 is supported 0435 openssl_version=1.1.1g 0436 else 0437 openssl_version=1.0.2u 0438 fi 0439 0440 if test "$compiler" = "gcc-self-contained"; then 0441 if test "$qt_nr" -lt 51500; then 0442 gcc_self_contained_cc="gcc-4.8" 0443 gcc_self_contained_cxx="g++-4.8" 0444 else 0445 gcc_self_contained_cc="gcc" 0446 gcc_self_contained_cxx="g++" 0447 fi 0448 fi 0449 0450 if test "$compiler" = "cross-mingw"; then 0451 if test -n "$QTPREFIX" && test -z "${QTPREFIX%%*64?(/)}"; then 0452 cross_host="x86_64-w64-mingw32" 0453 if hash ${cross_host}-gcc-posix 2>/dev/null; then 0454 _crossprefix=${cross_host}- 0455 # Qt uses posix threads, but x86_64-w64-mingw32-gcc uses win32 thread model. 0456 _crosssuffix=-posix 0457 elif hash ${cross_host}.shared-gcc 2>/dev/null; then 0458 _crossprefix=${cross_host}.shared- 0459 _crosssuffix= 0460 fi 0461 else 0462 cross_host="i686-w64-mingw32" 0463 _crossprefix=${cross_host}- 0464 _crosssuffix= 0465 # FFmpeg > 3 is not compatible with Windows XP 0466 ffmpeg_version=$ffmpeg3_version 0467 ffmpeg_patchlevel=$ffmpeg3_patchlevel 0468 fi 0469 elif test "$compiler" = "cross-macos"; then 0470 osxprefix=${OSXPREFIX:-/opt/osxcross/target} 0471 # e.g. x86_64-apple-darwin17 0472 cross_host=$($osxprefix/bin/o64-clang --version | grep Target | cut -d' ' -f2) 0473 _crossprefix=${cross_host}- 0474 # e.g. $osxprefix/SDK/MacOSX10.13.sdk 0475 osxsdk=($osxprefix/SDK/*.sdk) 0476 fi 0477 if test "$compiler" = "cross-android"; then 0478 _java_root=${JAVA_HOME:-/usr/lib/jvm/java-8-openjdk-amd64} 0479 _android_sdk_root=${ANDROID_SDK_ROOT:-/opt/android/sdk} 0480 _android_ndk_root=${ANDROID_NDK_ROOT:-$_android_sdk_root/ndk-bundle} 0481 _android_platform=${ANDROID_PLATFORM:-23} 0482 _android_ccache=$(which ccache || true) 0483 _android_qt_root=${QTPREFIX:-/opt/qt5/5.9.7/android_armv7} 0484 _android_toolchain_cmake=$_android_ndk_root/build/cmake/android.toolchain.cmake 0485 test -f $_android_toolchain_cmake || 0486 _android_toolchain_cmake=$srcdir/android/qt-android-cmake/toolchain/android.toolchain.cmake 0487 test -f $_android_qt_root/bin/qmake || 0488 _android_qt_root=/opt/qt5/5.9.7/android_armv7 0489 if test -z "${_android_qt_root%%*x86}"; then 0490 _android_abi=x86 0491 _android_prefix=i686-linux-android 0492 else 0493 _android_abi=armeabi-v7a 0494 _android_prefix=arm-linux-androideabi 0495 fi 0496 fi 0497 0498 _chocoInstall=${ChocolateyInstall//\\/\/} 0499 _chocoInstall=${_chocoInstall/C:/\/c} 0500 for d in "$DOCBOOK_XSL_DIR" /usr/share/xml/docbook/stylesheet/nwalsh /usr/share/xml/docbook/xsl-stylesheets-* /usr/local/Cellar/docbook-xsl/*/docbook-xsl /opt/homebrew/Cellar/docbook-xsl/*/docbook-xsl /opt/local/share/xsl/docbook-xsl $_chocoInstall/lib/docbook-bundle/docbook-xsl-*; do 0501 if test -e $d/xhtml/docbook.xsl; then 0502 _docbook_xsl_dir=$d 0503 break 0504 fi 0505 done 0506 0507 if test "$compiler" = "gcc-debug"; then 0508 export CFLAGS="-fPIC" 0509 export CXXFLAGS="-fPIC" 0510 FLAC_BUILD_OPTION="--enable-debug=yes" 0511 ID3LIB_BUILD_OPTION="--enable-debug=minimum" 0512 AV_BUILD_OPTION="--enable-debug=3 --enable-pic --extra-ldexeflags=-pie" 0513 CMAKE_BUILD_OPTION="-DCMAKE_BUILD_TYPE=Debug" 0514 elif test "$compiler" = "gcc-self-contained"; then 0515 export CC=$gcc_self_contained_cc 0516 export CXX=$gcc_self_contained_cxx 0517 export CFLAGS="-O2 -fPIC" 0518 export CXXFLAGS="-O2 -fPIC" 0519 FLAC_BUILD_OPTION="--enable-debug=info CFLAGS=-O2 CXXFLAGS=-O2" 0520 ID3LIB_BUILD_OPTION="--enable-debug=minimum" 0521 AV_BUILD_OPTION="--enable-debug=1 --enable-pic --extra-ldexeflags=-pie" 0522 CMAKE_BUILD_OPTION="-DCMAKE_BUILD_TYPE=RelWithDebInfo" 0523 else 0524 FLAC_BUILD_OPTION="--enable-debug=info CFLAGS=-O2 CXXFLAGS=-O2" 0525 ID3LIB_BUILD_OPTION="--enable-debug=minimum" 0526 AV_BUILD_OPTION="--enable-debug=1" 0527 CMAKE_BUILD_OPTION="-DCMAKE_BUILD_TYPE=RelWithDebInfo" 0528 fi 0529 0530 if ! which cmake >/dev/null; then 0531 echo "cmake not found." 0532 return 2>/dev/null 0533 exit 1 0534 fi 0535 0536 if test $kernel = "MSYS_NT-6.1"; then 0537 kernel="MINGW" 0538 CONFIGURE_OPTIONS="--build=x86_64-w64-mingw32 --target=i686-w64-mingw32" 0539 fi 0540 if test $kernel = "MINGW"; then 0541 # Use mingw from Qt 0542 if test -n "$QTPREFIX"; then 0543 test -z "${PATH##$QTPREFIX*}" || PATH=$QTPREFIX/bin:$QTPREFIX/../../Tools/mingw492_32/bin:$QTPREFIX/../../Tools/mingw492_32/opt/bin:$PATH 0544 else 0545 echo "QTPREFIX is not set" 0546 exit 1 0547 fi 0548 CMAKE_OPTIONS="-G \"MSYS Makefiles\" -DCMAKE_INSTALL_PREFIX=/usr/local" 0549 CONFIGURE_OPTIONS+=" --prefix=/usr/local" 0550 elif test $kernel = "Darwin"; then 0551 CMAKE_OPTIONS="-G \"Unix Makefiles\"" 0552 _macosx_version_min=10.7 0553 fi 0554 0555 if test "$compiler" = "cross-mingw"; then 0556 CMAKE_OPTIONS="$CMAKE_OPTIONS -DCMAKE_TOOLCHAIN_FILE=$thisdir/mingw.cmake" 0557 CONFIGURE_OPTIONS="--host=${cross_host}" 0558 if test "$cross_host" = "x86_64-w64-mingw32"; then 0559 export CC=${_crossprefix}gcc${_crosssuffix} 0560 export CXX=${_crossprefix}g++${_crosssuffix} 0561 fi 0562 elif test "$compiler" = "cross-macos"; then 0563 if test "$qt_nr" -ge 60500; then 0564 _macosx_version_min=10.15 0565 else 0566 _macosx_version_min=10.7 0567 fi 0568 CMAKE_OPTIONS="$CMAKE_OPTIONS -DCMAKE_TOOLCHAIN_FILE=$thisdir/osxcross.cmake -DCMAKE_C_FLAGS=\"-O2 -mmacosx-version-min=${_macosx_version_min}\" -DCMAKE_CXX_FLAGS=\"-O2 -mmacosx-version-min=${_macosx_version_min} -fvisibility=hidden -fvisibility-inlines-hidden -stdlib=libc++\" -DCMAKE_EXE_LINKER_FLAGS=-stdlib=libc++ -DCMAKE_MODULE_LINKER_FLAGS=-stdlib=libc++ -DCMAKE_SHARED_LINKER_FLAGS=-stdlib=libc++" 0569 CONFIGURE_OPTIONS="--host=${cross_host}" 0570 export CC=${_crossprefix}clang 0571 export CXX=${_crossprefix}clang++ 0572 export AR=${_crossprefix}ar 0573 export CFLAGS="-O2 $ARCH_FLAG -mmacosx-version-min=${_macosx_version_min}" 0574 export CXXFLAGS="-O2 $ARCH_FLAG -mmacosx-version-min=${_macosx_version_min} -stdlib=libc++" 0575 export LDFLAGS="$ARCH_FLAG -mmacosx-version-min=${_macosx_version_min} -stdlib=libc++" 0576 fi 0577 0578 if test $kernel = "MINGW" || test "$compiler" = "cross-mingw"; then 0579 # Build zlib only for Windows. 0580 ZLIB_ROOT_PATH="$thisdir/zlib-${zlib_version}.dfsg/inst/usr/local" 0581 TAGLIB_ZLIB_ROOT_OPTION="-DZLIB_ROOT=${ZLIB_ROOT_PATH}" 0582 CHROMAPRINT_ZLIB_OPTION="-DEXTRA_LIBS=\"-L${ZLIB_ROOT_PATH}/lib -lz\"" 0583 fi 0584 0585 if test $kernel = "Darwin"; then 0586 ARCH=$(uname -m) 0587 #ARCH=i386 0588 if test "$ARCH" = "i386"; then 0589 # To build a 32-bit Mac OS X version of Kid3 use: 0590 # cmake -G "Unix Makefiles" -DCMAKE_CXX_FLAGS="-arch i386" -DCMAKE_C_FLAGS="-arch i386" -DCMAKE_EXE_LINKER_FLAGS="-arch i386" -DQT_QMAKE_EXECUTABLE=/usr/local/Trolltech/Qt-${qt_version}-i386/bin/qmake -DCMAKE_BUILD_TYPE=Release -DWITH_FFMPEG=ON -DCMAKE_INSTALL_PREFIX= ../kid3 0591 # Building multiple architectures needs ARCH_FLAG="-arch i386 -arch x86_64", 0592 # CONFIGURE_OPTIONS="--disable-dependency-tracking", but it fails with libav. 0593 ARCH_FLAG="-arch i386" 0594 export CC=gcc 0595 export CXX=g++ 0596 else 0597 ARCH_FLAG="-Xarch_x86_64" 0598 fi 0599 if [[ $(sw_vers -productVersion) = 10.1* || $(sw_vers -productVersion) = 11.* ]]; then 0600 CMAKE_OPTIONS="$CMAKE_OPTIONS -DCMAKE_C_FLAGS=\"-O2 $ARCH_FLAG -mmacosx-version-min=${_macosx_version_min}\" -DCMAKE_CXX_FLAGS=\"-O2 $ARCH_FLAG -mmacosx-version-min=${_macosx_version_min} -fvisibility=hidden -fvisibility-inlines-hidden -stdlib=libc++\" -DCMAKE_EXE_LINKER_FLAGS=\"$ARCH_FLAG -stdlib=libc++\" -DCMAKE_MODULE_LINKER_FLAGS=\"$ARCH_FLAG -stdlib=libc++\" -DCMAKE_SHARED_LINKER_FLAGS=\"$ARCH_FLAG -stdlib=libc++\"" 0601 export CFLAGS="-O2 $ARCH_FLAG -mmacosx-version-min=${_macosx_version_min}" 0602 export CXXFLAGS="-O2 $ARCH_FLAG -mmacosx-version-min=${_macosx_version_min} -stdlib=libc++" 0603 export LDFLAGS="$ARCH_FLAG -mmacosx-version-min=${_macosx_version_min} -stdlib=libc++" 0604 else 0605 CMAKE_OPTIONS="$CMAKE_OPTIONS -DCMAKE_C_FLAGS=\"-O2 $ARCH_FLAG -mmacosx-version-min=10.5\" -DCMAKE_CXX_FLAGS=\"-O2 $ARCH_FLAG -mmacosx-version-min=10.5 -fvisibility=hidden -fvisibility-inlines-hidden\"" 0606 export CFLAGS="-O2 $ARCH_FLAG -mmacosx-version-min=10.5" 0607 export CXXFLAGS="-O2 $ARCH_FLAG -mmacosx-version-min=10.5" 0608 export LDFLAGS="$ARCH_FLAG -mmacosx-version-min=10.5" 0609 fi 0610 fi # Darwin 0611 0612 if which wget >/dev/null; then 0613 DOWNLOAD=wget 0614 else 0615 DOWNLOAD="curl -skfLO" 0616 fi 0617 0618 test -d buildroot || mkdir buildroot 0619 BUILDROOT=`pwd`/buildroot/ 0620 0621 fixcmakeinst() { 0622 if test -d inst && test $kernel = "MINGW"; then 0623 cd inst 0624 if test -d prg; then 0625 rm -rf usr 0626 mv prg/msys usr 0627 rmdir prg 0628 elif test -d msys; then 0629 rm -rf usr 0630 mv msys/1.0 usr 0631 rmdir msys 0632 elif test -d MinGW; then 0633 mv MinGW usr 0634 elif test -d msys64; then 0635 rm -rf usr 0636 mv msys64/usr . 0637 rmdir msys64 0638 elif test -d msys32; then 0639 rm -rf usr 0640 mv msys32/usr . 0641 rmdir msys32 0642 fi 0643 cd .. 0644 fi 0645 } 0646 0647 if test "$compiler" = "cross-mingw" || test "$compiler" = "cross-macos"; then 0648 if test -n "$QTBINARYDIR"; then 0649 _qt_bin_dir=$QTBINARYDIR 0650 else 0651 for d in $thisdir/qtbase5-dev-tools* /usr/lib/${HOSTTYPE/i686/i386}-linux-gnu/qt5/bin /usr/bin; do 0652 if test -x $d/moc; then 0653 _qt_bin_dir=$d 0654 break 0655 fi 0656 done 0657 fi 0658 if test -n "$QTPREFIX"; then 0659 _qt_prefix=$QTPREFIX 0660 else 0661 if test "$compiler" = "cross-mingw"; then 0662 for d in /windows/Qt/${qt_version}/mingw* /windows/Qt/Qt${qt_version}/${qt_version}/mingw* $thisdir/Qt*-mingw/${qt_version}/mingw*; do 0663 if test -d $d; then 0664 _qt_prefix=$d 0665 break 0666 fi 0667 done 0668 elif test "$compiler" = "cross-macos"; then 0669 for d in $thisdir/Qt*-mac/${qt_version}/clang_64 $HOME/Development/Qt*-mac/${qt_version}/clang_64; do 0670 if test -d $d; then 0671 _qt_prefix=$d 0672 break 0673 fi 0674 done 0675 fi 0676 fi 0677 fi # cross-mingw || cross-macos 0678 if test "$compiler" = "cross-mingw"; then 0679 if ! test -f $thisdir/mingw.cmake; then 0680 cat >$thisdir/mingw.cmake <<EOF 0681 set(QT_PREFIX ${_qt_prefix}) 0682 0683 set(CMAKE_SYSTEM_NAME Windows) 0684 set(CMAKE_C_COMPILER ${_crossprefix}gcc${_crosssuffix}) 0685 set(CMAKE_CXX_COMPILER ${_crossprefix}g++${_crosssuffix}) 0686 set(CMAKE_RC_COMPILER ${_crossprefix}windres) 0687 set(CMAKE_FIND_ROOT_PATH /usr/${cross_host} \${QT_PREFIX} $thisdir/buildroot/usr/local ${ZLIB_ROOT_PATH} $thisdir/ffmpeg-${ffmpeg_version}/inst/usr/local) 0688 set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) 0689 set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) 0690 set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) 0691 0692 EOF 0693 if test "$qt_version_major" = "6"; then 0694 _qt_libexec_dir=${_qt_bin_dir%bin}libexec 0695 cat >>$thisdir/mingw.cmake <<EOF 0696 set(QT_BINARY_DIR ${_qt_bin_dir}) 0697 set(QT_LIBEXEC_DIR ${_qt_libexec_dir}) 0698 set(QT_LIBRARY_DIR \${QT_PREFIX}/lib) 0699 set(QT_QTCORE_LIBRARY \${QT_PREFIX}/lib/libQt${qt_version_major}Core.a) 0700 set(QT_QTCORE_INCLUDE_DIR \${QT_PREFIX}/include/QtCore) 0701 set(QT_MKSPECS_DIR \${QT_PREFIX}/mkspecs) 0702 set(QT_MOC_EXECUTABLE \${QT_LIBEXEC_DIR}/moc) 0703 set(QT_UIC_EXECUTABLE \${QT_LIBEXEC_DIR}/uic) 0704 0705 foreach (_exe moc rcc uic tracegen cmake_automoc_parser qlalr lprodump lrelease-pro lupdate-pro tracepointgen) 0706 if (NOT TARGET Qt${qt_version_major}::\${_exe}) 0707 add_executable(Qt${qt_version_major}::\${_exe} IMPORTED) 0708 set_target_properties(Qt${qt_version_major}::\${_exe} PROPERTIES 0709 IMPORTED_LOCATION \${QT_LIBEXEC_DIR}/\${_exe} 0710 ) 0711 endif () 0712 endforeach (_exe) 0713 foreach (_exe lupdate lrelease windeployqt qtpaths androiddeployqt androidtestrunner lconvert) 0714 if (NOT TARGET Qt${qt_version_major}::\${_exe}) 0715 add_executable(Qt${qt_version_major}::\${_exe} IMPORTED) 0716 set_target_properties(Qt${qt_version_major}::\${_exe} PROPERTIES 0717 IMPORTED_LOCATION \${QT_BINARY_DIR}/\${_exe} 0718 ) 0719 endif () 0720 endforeach (_exe) 0721 foreach (_exe qmake) 0722 if (NOT TARGET Qt${qt_version_major}::\${_exe}) 0723 add_executable(Qt${qt_version_major}::\${_exe} IMPORTED) 0724 set_target_properties(Qt${qt_version_major}::\${_exe} PROPERTIES 0725 IMPORTED_LOCATION \${QT_PREFIX}/bin/\${_exe} 0726 ) 0727 endif () 0728 endforeach (_exe) 0729 EOF 0730 else 0731 cat >>$thisdir/mingw.cmake <<EOF 0732 set(QT_BINARY_DIR ${_qt_bin_dir}) 0733 set(QT_LIBRARY_DIR \${QT_PREFIX}/lib) 0734 set(QT_QTCORE_LIBRARY \${QT_PREFIX}/lib/libQt${qt_version_major}Core.a) 0735 set(QT_QTCORE_INCLUDE_DIR \${QT_PREFIX}/include/QtCore) 0736 set(QT_MKSPECS_DIR \${QT_PREFIX}/mkspecs) 0737 set(QT_MOC_EXECUTABLE \${QT_BINARY_DIR}/moc) 0738 set(QT_UIC_EXECUTABLE \${QT_BINARY_DIR}/uic) 0739 0740 foreach (_exe moc rcc lupdate lrelease uic) 0741 if (NOT TARGET Qt${qt_version_major}::\${_exe}) 0742 add_executable(Qt${qt_version_major}::\${_exe} IMPORTED) 0743 set_target_properties(Qt${qt_version_major}::\${_exe} PROPERTIES 0744 IMPORTED_LOCATION \${QT_BINARY_DIR}/\${_exe} 0745 ) 0746 endif () 0747 endforeach (_exe) 0748 EOF 0749 fi 0750 fi 0751 elif test "$compiler" = "cross-macos"; then 0752 test -z ${PATH##$osxprefix/*} || PATH=$osxprefix/bin:$osxsdk/usr/bin:$PATH 0753 if ! test -f $thisdir/osxcross.cmake; then 0754 cat >$thisdir/osxcross.cmake <<EOF 0755 if (POLICY CMP0025) 0756 cmake_policy(SET CMP0025 NEW) 0757 endif (POLICY CMP0025) 0758 0759 set(QT_PREFIX $_qt_prefix) 0760 0761 set(CMAKE_SYSTEM_NAME Darwin) 0762 set(CMAKE_C_COMPILER $osxprefix/lib/ccache/bin/${_crossprefix}clang) 0763 set(CMAKE_CXX_COMPILER $osxprefix/lib/ccache/bin/${_crossprefix}clang++) 0764 set(CMAKE_FIND_ROOT_PATH $osxprefix/${cross_host};$osxsdk/usr;$osxprefix/${cross_host};$osxsdk;$osxsdk/System/Library/Frameworks/OpenGL.framework/Versions/A/Headers;\${QT_PREFIX};$thisdir/buildroot/usr/local) 0765 set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) 0766 set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) 0767 set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) 0768 set(CMAKE_AR:FILEPATH ${_crossprefix}ar) 0769 set(CMAKE_RANLIB:FILEPATH ${_crossprefix}ranlib) 0770 set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,") 0771 set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":") 0772 0773 EOF 0774 if test "$qt_version_major" = "6"; then 0775 _qt_libexec_dir=${_qt_bin_dir%bin}libexec 0776 cat >>$thisdir/osxcross.cmake <<EOF 0777 set(QT_INCLUDE_DIRS_NO_SYSTEM ON) 0778 set(QT_BINARY_DIR ${_qt_bin_dir}) 0779 set(QT_LIBEXEC_DIR ${_qt_libexec_dir}) 0780 set(QT_LIBRARY_DIR \${QT_PREFIX}/lib) 0781 set(Qt${qt_version_major}Core_DIR \${QT_PREFIX}/lib/cmake/Qt${qt_version_major}Core) 0782 set(QT_MKSPECS_DIR \${QT_PREFIX}/mkspecs) 0783 set(QT_MOC_EXECUTABLE \${QT_LIBEXEC_DIR}/moc) 0784 set(QT_UIC_EXECUTABLE \${QT_LIBEXEC_DIR}/uic) 0785 0786 foreach (_exe moc rcc uic tracegen cmake_automoc_parser qlalr lprodump lrelease-pro lupdate-pro tracepointgen) 0787 if (NOT TARGET Qt${qt_version_major}::\${_exe}) 0788 add_executable(Qt${qt_version_major}::\${_exe} IMPORTED) 0789 set_target_properties(Qt${qt_version_major}::\${_exe} PROPERTIES 0790 IMPORTED_LOCATION \${QT_LIBEXEC_DIR}/\${_exe} 0791 ) 0792 endif () 0793 endforeach (_exe) 0794 foreach (_exe lupdate lrelease macdeployqt qtpaths androiddeployqt androidtestrunner lconvert) 0795 if (NOT TARGET Qt${qt_version_major}::\${_exe}) 0796 add_executable(Qt${qt_version_major}::\${_exe} IMPORTED) 0797 set_target_properties(Qt${qt_version_major}::\${_exe} PROPERTIES 0798 IMPORTED_LOCATION \${QT_BINARY_DIR}/\${_exe} 0799 ) 0800 endif () 0801 endforeach (_exe) 0802 foreach (_exe qmake) 0803 if (NOT TARGET Qt${qt_version_major}::\${_exe}) 0804 add_executable(Qt${qt_version_major}::\${_exe} IMPORTED) 0805 set_target_properties(Qt${qt_version_major}::\${_exe} PROPERTIES 0806 IMPORTED_LOCATION \${QT_PREFIX}/bin/\${_exe} 0807 ) 0808 endif () 0809 endforeach (_exe) 0810 EOF 0811 else 0812 cat >>$thisdir/osxcross.cmake <<EOF 0813 set(QT_INCLUDE_DIRS_NO_SYSTEM ON) 0814 set(QT_BINARY_DIR ${_qt_bin_dir}) 0815 set(QT_LIBRARY_DIR \${QT_PREFIX}/lib) 0816 set(Qt${qt_version_major}Core_DIR \${QT_PREFIX}/lib/cmake/Qt${qt_version_major}Core) 0817 set(QT_MKSPECS_DIR \${QT_PREFIX}/mkspecs) 0818 set(QT_MOC_EXECUTABLE \${QT_BINARY_DIR}/moc) 0819 set(QT_UIC_EXECUTABLE \${QT_BINARY_DIR}/uic) 0820 0821 foreach (_exe moc rcc lupdate lrelease uic) 0822 if (NOT TARGET Qt${qt_version_major}::\${_exe}) 0823 add_executable(Qt${qt_version_major}::\${_exe} IMPORTED) 0824 set_target_properties(Qt${qt_version_major}::\${_exe} PROPERTIES 0825 IMPORTED_LOCATION \${QT_BINARY_DIR}/\${_exe} 0826 ) 0827 endif () 0828 endforeach (_exe) 0829 EOF 0830 fi 0831 fi 0832 fi # cross-mingw, cross-macos 0833 0834 if [[ $target = *"libs"* ]]; then 0835 0836 # Download sources 0837 0838 test -d source || mkdir source 0839 cd source 0840 0841 if test -n "${taglib_githash}"; then 0842 # Download an archive for a git hash 0843 if ! test -f taglib-${taglib_githash}.tar.gz; then 0844 $DOWNLOAD https://github.com/taglib/taglib/archive/${taglib_githash}.tar.gz 0845 mv ${taglib_githash}.tar.gz taglib-${taglib_githash}.tar.gz 0846 fi 0847 elif test -n "${taglib_version##v*}"; then 0848 test -f taglib-${taglib_version}.tar.gz || 0849 $DOWNLOAD http://taglib.github.io/releases/taglib-${taglib_version}.tar.gz 0850 else 0851 # Download an archive for a git tag 0852 if ! test -f taglib-${taglib_version##v}.tar.gz; then 0853 $DOWNLOAD https://github.com/taglib/taglib/archive/${taglib_version}.tar.gz 0854 mv ${taglib_version}.tar.gz taglib-${taglib_version##v}.tar.gz 0855 fi 0856 taglib_version=${taglib_version##v} 0857 fi 0858 0859 if ! test -f utfcpp-${utfcpp_version}.tar.gz; then 0860 $DOWNLOAD https://github.com/nemtrif/utfcpp/archive/refs/tags/v${utfcpp_version}.tar.gz 0861 mv v${utfcpp_version}.tar.gz utfcpp-${utfcpp_version}.tar.gz 0862 fi 0863 0864 if test "$compiler" != "cross-android"; then 0865 0866 test -f flac_${libflac_version}-${libflac_patchlevel}.debian.tar.xz || 0867 $DOWNLOAD http://ftp.de.debian.org/debian/pool/main/f/flac/flac_${libflac_version}-${libflac_patchlevel}.debian.tar.xz 0868 test -f flac_${libflac_version}.orig.tar.xz || 0869 $DOWNLOAD http://ftp.de.debian.org/debian/pool/main/f/flac/flac_${libflac_version}.orig.tar.xz 0870 0871 test -f id3lib3.8.3_${id3lib_version}-${id3lib_patchlevel}.debian.tar.xz || 0872 $DOWNLOAD http://ftp.de.debian.org/debian/pool/main/i/id3lib3.8.3/id3lib3.8.3_${id3lib_version}-${id3lib_patchlevel}.debian.tar.xz 0873 test -f id3lib3.8.3_${id3lib_version}.orig.tar.gz || 0874 $DOWNLOAD http://ftp.de.debian.org/debian/pool/main/i/id3lib3.8.3/id3lib3.8.3_${id3lib_version}.orig.tar.gz 0875 0876 test -f libogg_${libogg_version}-${libogg_patchlevel}.diff.gz || 0877 $DOWNLOAD http://ftp.de.debian.org/debian/pool/main/libo/libogg/libogg_${libogg_version}-${libogg_patchlevel}.diff.gz 0878 test -f libogg_${libogg_version}.orig.tar.gz || 0879 $DOWNLOAD http://ftp.de.debian.org/debian/pool/main/libo/libogg/libogg_${libogg_version}.orig.tar.gz 0880 0881 test -f libvorbis_${libvorbis_version}-${libvorbis_patchlevel}.debian.tar.xz || 0882 $DOWNLOAD http://ftp.de.debian.org/debian/pool/main/libv/libvorbis/libvorbis_${libvorbis_version}-${libvorbis_patchlevel}.debian.tar.xz 0883 test -f libvorbis_${libvorbis_version}.orig.tar.gz || 0884 $DOWNLOAD http://ftp.de.debian.org/debian/pool/main/libv/libvorbis/libvorbis_${libvorbis_version}.orig.tar.gz 0885 0886 if test -n "$ZLIB_ROOT_PATH"; then 0887 test -f zlib_${zlib_version}.dfsg-${zlib_patchlevel}.debian.tar.xz || 0888 $DOWNLOAD http://ftp.de.debian.org/debian/pool/main/z/zlib/zlib_${zlib_version}.dfsg-${zlib_patchlevel}.debian.tar.xz 0889 test -f zlib_${zlib_version}.dfsg.orig.tar.bz2 || 0890 $DOWNLOAD http://ftp.de.debian.org/debian/pool/main/z/zlib/zlib_${zlib_version}.dfsg.orig.tar.bz2 0891 fi 0892 0893 test -f ffmpeg_${ffmpeg_version}.orig.tar.xz || 0894 $DOWNLOAD http://ftp.de.debian.org/debian/pool/main/f/ffmpeg/ffmpeg_${ffmpeg_version}.orig.tar.xz 0895 test -f ffmpeg_${ffmpeg_version}-${ffmpeg_patchlevel}.debian.tar.xz || 0896 $DOWNLOAD http://ftp.de.debian.org/debian/pool/main/f/ffmpeg/ffmpeg_${ffmpeg_version}-${ffmpeg_patchlevel}.debian.tar.xz 0897 0898 test -f chromaprint_${chromaprint_version}.orig.tar.gz || 0899 $DOWNLOAD http://ftp.de.debian.org/debian/pool/main/c/chromaprint/chromaprint_${chromaprint_version}.orig.tar.gz 0900 test -f chromaprint_${chromaprint_version}-${chromaprint_patchlevel}.debian.tar.xz || 0901 $DOWNLOAD http://ftp.de.debian.org/debian/pool/main/c/chromaprint/chromaprint_${chromaprint_version}-${chromaprint_patchlevel}.debian.tar.xz 0902 0903 test -f mp4v2-${mp4v2_version}.tar.bz2 || 0904 $DOWNLOAD https://github.com/enzo1982/mp4v2/releases/download/v${mp4v2_version}/mp4v2-${mp4v2_version}.tar.bz2 0905 0906 fi # !cross-android 0907 0908 if test "$compiler" = "cross-android" || test "$compiler" = "gcc-self-contained" || test "$compiler" = "gcc-debug" \ 0909 || ( ( test "$compiler" = "cross-mingw" || test "$kernel" = "MINGW" ) && test "${openssl_version:0:3}" != "1.0" ); then 0910 # See http://doc.qt.io/qt-5/opensslsupport.html 0911 test -f Setenv-android.sh || 0912 $DOWNLOAD https://wiki.openssl.org/images/7/70/Setenv-android.sh 0913 test -f openssl-${openssl_version}.tar.gz || 0914 $DOWNLOAD https://www.openssl.org/source/openssl-${openssl_version}.tar.gz 0915 fi 0916 0917 cd .. 0918 0919 0920 # Extract and patch sources 0921 0922 if ! test -d utfcpp-${utfcpp_version}; then 0923 echo "### Extracting utfcpp" 0924 tar xzf source/utfcpp-${utfcpp_version}.tar.gz 0925 fi 0926 0927 if ! test -d taglib-${taglib_version}; then 0928 echo "### Extracting taglib" 0929 0930 if test -n "${taglib_githash}"; then 0931 tar xzf source/taglib-${taglib_githash}.tar.gz 0932 mv taglib-${taglib_githash} taglib-${taglib_version} 0933 else 0934 tar xzf source/taglib-${taglib_version}.tar.gz 0935 fi 0936 cd taglib-${taglib_version}/ 0937 if test "$cross_host" = "x86_64-w64-mingw32"; then 0938 if test -f $srcdir/packaging/patches/taglib-${taglib_githash}-win00-large_file.patch; then 0939 patch -p1 <$srcdir/packaging/patches/taglib-${taglib_githash}-win00-large_file.patch 0940 elif test -f $srcdir/packaging/patches/taglib-${taglib_version}-win00-large_file.patch; then 0941 patch -p1 <$srcdir/packaging/patches/taglib-${taglib_version}-win00-large_file.patch 0942 fi 0943 fi 0944 cd .. 0945 fi 0946 0947 if test "$compiler" != "cross-android"; then 0948 0949 if test -n "$ZLIB_ROOT_PATH"; then 0950 if ! test -d zlib-${zlib_version}; then 0951 echo "### Extracting zlib" 0952 0953 tar xjf source/zlib_${zlib_version}.dfsg.orig.tar.bz2 0954 cd zlib-${zlib_version}.dfsg/ 0955 0956 tar xJf ../source/zlib_${zlib_version}.dfsg-${zlib_patchlevel}.debian.tar.xz || true 0957 echo Can be ignored: Cannot create symlink to debian.series 0958 for f in $(cat debian/patches/debian.series); do patch -p1 <debian/patches/$f; done 0959 cd .. 0960 fi 0961 fi 0962 0963 if ! test -d libogg-${libogg_version}; then 0964 echo "### Extracting libogg" 0965 0966 tar xzf source/libogg_${libogg_version}.orig.tar.gz 0967 cd libogg-${libogg_version}/ 0968 gunzip -c ../source/libogg_${libogg_version}-${libogg_patchlevel}.diff.gz | patch -p1 0969 if test $kernel = "Darwin" || test "$compiler" = "cross-macos"; then 0970 patch -p1 <$srcdir/packaging/patches/libogg-1.3.4-00-mac.patch 0971 fi 0972 cd .. 0973 fi 0974 0975 if ! test -d libvorbis-${libvorbis_version}; then 0976 echo "### Extracting libvorbis" 0977 0978 tar xzf source/libvorbis_${libvorbis_version}.orig.tar.gz 0979 cd libvorbis-${libvorbis_version}/ 0980 tar xJf ../source/libvorbis_${libvorbis_version}-${libvorbis_patchlevel}.debian.tar.xz 0981 for f in $(cat debian/patches/series); do patch -p1 <debian/patches/$f; done 0982 test -f win32/VS2010/libogg.props.orig || mv win32/VS2010/libogg.props win32/VS2010/libogg.props.orig 0983 sed "s/<LIBOGG_VERSION>1.2.0</<LIBOGG_VERSION>$libogg_version</" win32/VS2010/libogg.props.orig >win32/VS2010/libogg.props 0984 cd .. 0985 fi 0986 0987 if ! test -d flac-${libflac_version%+ds*}; then 0988 echo "### Extracting libflac" 0989 0990 tar xJf source/flac_${libflac_version}.orig.tar.xz 0991 cd flac-${libflac_version%+ds*}/ 0992 tar xJf ../source/flac_${libflac_version}-${libflac_patchlevel}.debian.tar.xz 0993 for f in $(cat debian/patches/series); do patch -p1 <debian/patches/$f; done 0994 patch -p1 <$srcdir/packaging/patches/flac-1.2.1-00-size_t_max.patch 0995 cd .. 0996 fi 0997 0998 if ! test -d id3lib-${id3lib_version}; then 0999 echo "### Extracting id3lib" 1000 1001 tar xzf source/id3lib3.8.3_${id3lib_version}.orig.tar.gz 1002 cd id3lib-${id3lib_version}/ 1003 tar xJf ../source/id3lib3.8.3_${id3lib_version}-${id3lib_patchlevel}.debian.tar.xz 1004 for f in $(cat debian/patches/series); do patch --binary -p1 <debian/patches/$f; done 1005 patch -p1 <$srcdir/packaging/patches/id3lib-3.8.3-win00-mingw.patch 1006 patch -p1 <$srcdir/packaging/patches/id3lib-3.8.3-win01-tempfile.patch 1007 test -f makefile.win32.orig || mv makefile.win32 makefile.win32.orig 1008 sed 's/-W3 -WX -GX/-W3 -EHsc/; s/-MD -D "WIN32" -D "_DEBUG"/-MDd -D "WIN32" -D "_DEBUG"/' makefile.win32.orig >makefile.win32 1009 cd .. 1010 fi 1011 1012 if ! test -d ffmpeg-${ffmpeg_version}; then 1013 echo "### Extracting ffmpeg" 1014 1015 tar xJf source/ffmpeg_${ffmpeg_version}.orig.tar.xz || true 1016 cd ffmpeg-${ffmpeg_version}/ 1017 tar xJf ../source/ffmpeg_${ffmpeg_version}-${ffmpeg_patchlevel}.debian.tar.xz || true 1018 for f in $(cat debian/patches/series); do patch -p1 <debian/patches/$f; done 1019 cd .. 1020 fi 1021 1022 if ! test -d chromaprint-${chromaprint_version}; then 1023 echo "### Extracting chromaprint" 1024 1025 tar xzf source/chromaprint_${chromaprint_version}.orig.tar.gz 1026 cd chromaprint-${chromaprint_version}/ 1027 tar xJf ../source/chromaprint_${chromaprint_version}-${chromaprint_patchlevel}.debian.tar.xz 1028 for f in $(cat debian/patches/series); do patch -p1 <debian/patches/$f; done 1029 cd .. 1030 fi 1031 1032 if ! test -d mp4v2-${mp4v2_version}; then 1033 echo "### Extracting mp4v2" 1034 1035 tar xjf source/mp4v2-${mp4v2_version}.tar.bz2 1036 fi 1037 1038 fi # !cross-android 1039 1040 if test "$compiler" = "cross-android"; then 1041 1042 if ! test -d openssl-${openssl_version}; then 1043 echo "### Extracting openssl" 1044 1045 tar xzf source/openssl-${openssl_version}.tar.gz 1046 if test "$qt_nr" -lt 60000; then 1047 cp source/Setenv-android.sh openssl-${openssl_version}/ 1048 cd openssl-${openssl_version}/ 1049 sed -i 's/\r$//' Setenv-android.sh 1050 test -n "$ANDROID_NDK_ROOT" && \ 1051 sed -i "s#^ANDROID_NDK_ROOT=.*#ANDROID_NDK_ROOT=$ANDROID_NDK_ROOT#" \ 1052 Setenv-android.sh 1053 chmod +x Setenv-android.sh 1054 patch -p0 <$srcdir/packaging/patches/openssl-1.1.1-android00-setenv.patch 1055 cd .. 1056 fi 1057 fi 1058 1059 elif test "$compiler" = "gcc-self-contained" || test "$compiler" = "gcc-debug" \ 1060 || ( ( test "$compiler" = "cross-mingw" || test "$kernel" = "MINGW" ) && test "${openssl_version:0:3}" != "1.0" ); then 1061 1062 if ! test -d openssl-${openssl_version}; then 1063 echo "### Extracting openssl" 1064 tar xzf source/openssl-${openssl_version}.tar.gz 1065 fi 1066 1067 fi # cross-android 1068 1069 # Build from sources 1070 1071 test -d bin || mkdir bin 1072 1073 if test "$compiler" = "cross-android"; then 1074 1075 if test ! -d openssl-${openssl_version}/inst; then 1076 echo "### Building OpenSSL" 1077 1078 cd openssl-${openssl_version}/ 1079 if test "$qt_nr" -lt 60000; then 1080 if test "$_android_abi" = "x86"; then 1081 sed -i 's/^_ANDROID_EABI=.*$/_ANDROID_EABI=x86-4.9/; s/^_ANDROID_ARCH=.*$/_ANDROID_ARCH=arch-x86/' Setenv-android.sh 1082 else 1083 sed -i 's/^_ANDROID_EABI=.*$/_ANDROID_EABI=arm-linux-androideabi-4.9/; s/^_ANDROID_ARCH=.*$/_ANDROID_ARCH=arch-arm/' Setenv-android.sh 1084 fi 1085 sed -i "s#^_ANDROID_NDK=.*#ANDROID_NDK_ROOT=$_android_ndk_root#" Setenv-android.sh 1086 sed -i '/FIPS_SIG location/,/^fi$/ d' Setenv-android.sh 1087 if test -d $_android_ndk_root/toolchains/llvm; then 1088 sed -i 's/^_ANDROID_EABI=.*$/_ANDROID_EABI=llvm/' Setenv-android.sh 1089 fi 1090 . ./Setenv-android.sh 1091 if test "${openssl_version:0:3}" = "1.0"; then 1092 ./Configure shared android 1093 else 1094 ANDROID_NDK_HOME=$ANDROID_NDK_ROOT ./Configure shared android-armeabi 1095 fi 1096 if test -d $_android_ndk_root/toolchains/llvm; then 1097 if test "$_android_abi" = "x86"; then 1098 sed -i 's/^CC=.*$/CC= i686-linux-android16-clang/; s/ -mandroid//' Makefile 1099 else 1100 sed -i 's/^CC=.*$/CC= armv7a-linux-androideabi16-clang/; s/ -mandroid//' Makefile 1101 fi 1102 fi 1103 1104 if test "${openssl_version:0:3}" = "1.0"; then 1105 make CALC_VERSIONS="SHLIB_COMPAT=; SHLIB_SOVER=" build_libs 1106 _ssl_lib_suffix=.so 1107 else 1108 make ANDROID_NDK_HOME=$ANDROID_NDK_ROOT SHLIB_VERSION_NUMBER= SHLIB_EXT=_1_1.so build_libs 1109 _ssl_lib_suffix=_1_1.so 1110 fi 1111 else 1112 PATH=$ANDROID_NDK_ROOT/toolchains/llvm/prebuilt/linux-x86_64/bin:$PATH 1113 sed -i 's/shared_extension => ".so",/shared_extension => "_3.so",/' Configurations/15-android.conf 1114 ANDROID_NDK_HOME=$ANDROID_NDK_ROOT ./Configure shared android-arm 1115 sed -i "s,^DESTDIR=\$,DESTDIR=$PWD/inst," Makefile 1116 make ANDROID_NDK_HOME=$ANDROID_NDK_ROOT SHLIB_VERSION_NUMBER= SHLIB_EXT=_3.so build_libs install_dev 1117 _ssl_lib_suffix=_3.so 1118 _android_prefix=llvm 1119 fi 1120 mkdir -p inst/usr/local/lib 1121 cp --dereference libssl${_ssl_lib_suffix} libcrypto${_ssl_lib_suffix} inst/usr/local/lib/ 1122 $_android_prefix-strip -s inst/usr/local/lib/*.so 1123 cd inst 1124 tar czf ../../bin/openssl-${openssl_version}.tgz usr 1125 cd ../.. 1126 tar xmzf bin/openssl-${openssl_version}.tgz -C $BUILDROOT 1127 fi 1128 1129 if test ! -d utfcpp-${utfcpp_version}/inst; then 1130 echo "### Building utfcpp" 1131 1132 cd utfcpp-${utfcpp_version}/ 1133 test -f Makefile || eval cmake $CMAKE_BUILD_OPTION $CMAKE_OPTIONS -DUTF8_TESTS=OFF 1134 make VERBOSE=1 1135 mkdir -p inst 1136 make install DESTDIR=`pwd`/inst 1137 fixcmakeinst 1138 cd inst 1139 tar czf ../../bin/utfcpp-${utfcpp_version}.tgz usr 1140 cd ../.. 1141 tar xmzf bin/utfcpp-${utfcpp_version}.tgz -C $BUILDROOT 1142 fi 1143 1144 if ! test -f $BUILDROOT/usr/local/lib/libtag.a; then 1145 echo "### Building taglib" 1146 1147 cd taglib-${taglib_version}/ 1148 cmake -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$BUILDROOT/usr/local -DCMAKE_FIND_ROOT_PATH=$BUILDROOT/usr/local -DANDROID_NDK=$_android_ndk_root -DANDROID_ABI=$_android_abi -DCMAKE_TOOLCHAIN_FILE=$_android_toolchain_cmake -DANDROID_PLATFORM=$_android_platform -DANDROID_CCACHE=$_android_ccache -DCMAKE_MAKE_PROGRAM=make 1149 make install 1150 cd .. 1151 fi 1152 1153 else # cross-android 1154 1155 if test "$1" = "clean"; then 1156 for d in zlib-${zlib_version}.dfsg libogg-${libogg_version} \ 1157 libvorbis-${libvorbis_version} flac-${libflac_version%+ds*} \ 1158 id3lib-${id3lib_version} taglib-${taglib_version} \ 1159 ffmpeg-${ffmpeg_version} chromaprint-${chromaprint_version} \ 1160 mp4v2-${mp4v2_version} utfcpp-${utfcpp_version}; do 1161 test -d $d/inst && rm -rf $d/inst 1162 done 1163 fi 1164 1165 if ( test "$compiler" = "gcc-self-contained" || test "$compiler" = "gcc-debug" ) && test ! -d openssl-${openssl_version}/inst; then 1166 echo "### Building OpenSSL" 1167 1168 cd openssl-${openssl_version} 1169 ./Configure shared enable-ec_nistp_64_gcc_128 linux-x86_64 -Wa,--noexecstack 1170 make depend || true 1171 make build_libs 1172 mkdir -p inst/usr/local/ssl 1173 cp --dereference libssl.so libcrypto.so inst/usr/local/ssl/ 1174 strip -s inst/usr/local/ssl/*.so 1175 cd inst 1176 tar czf ../../bin/openssl-${openssl_version}.tgz usr 1177 cd ../.. 1178 tar xmzf bin/openssl-${openssl_version}.tgz -C $BUILDROOT 1179 1180 elif ( ( test "$compiler" = "cross-mingw" || test "$kernel" = "MINGW" ) && test "${openssl_version:0:3}" != "1.0" ) \ 1181 && test ! -d openssl-${openssl_version}/inst; then 1182 echo "### Building OpenSSL" 1183 1184 cd openssl-${openssl_version} 1185 if test "$cross_host" = "x86_64-w64-mingw32" || [[ $(uname) =~ ^MINGW64 ]]; then 1186 _target=mingw64 1187 else 1188 _target=mingw 1189 fi 1190 if test -z "${cross_host}"; then 1191 _crossprefix= 1192 fi 1193 if test "$cross_host" = "x86_64-w64-mingw32"; then 1194 _cctmp=$CC 1195 CC=gcc${_crosssuffix} 1196 fi 1197 ./Configure shared enable-ec_nistp_64_gcc_128 $_target --cross-compile-prefix=$_crossprefix 1198 make depend || true 1199 make build_libs 1200 if test "$cross_host" = "x86_64-w64-mingw32"; then 1201 CC=$_cctmp 1202 fi 1203 mkdir -p inst/usr/local/ssl 1204 cp lib{ssl,crypto}*.dll inst/usr/local/ssl/ 1205 ${_crossprefix}strip -s inst/usr/local/ssl/*.dll 1206 cd inst 1207 tar czf ../../bin/openssl-${openssl_version}.tgz usr 1208 cd ../.. 1209 tar xmzf bin/openssl-${openssl_version}.tgz -C $BUILDROOT 1210 fi 1211 1212 if test -n "$ZLIB_ROOT_PATH" && test ! -d zlib-${zlib_version}.dfsg/inst; then 1213 echo "### Building zlib" 1214 1215 cd zlib-${zlib_version}.dfsg/ 1216 mkdir -p inst/usr/local 1217 if test $kernel = "MINGW"; then 1218 CFLAGS="$CFLAGS -g -O3 -Wall -DNO_FSEEKO" ./configure --static 1219 make install prefix=`pwd`/inst/usr/local 1220 elif test "$compiler" = "cross-mingw"; then 1221 CHOST=${_crossprefix} CFLAGS="$CFLAGS -g -O3 -Wall -DNO_FSEEKO" ./configure --static 1222 make install prefix=`pwd`/inst/usr/local 1223 else 1224 CFLAGS="$CFLAGS -g -O3 -Wall -DNO_FSEEKO" ./configure --static 1225 sed 's/LIBS=$(STATICLIB) $(SHAREDLIB) $(SHAREDLIBV)/LIBS=$(STATICLIB)/' Makefile >Makefile.inst 1226 make install -f Makefile.inst prefix=`pwd`/inst/usr/local 1227 fi 1228 cd inst 1229 tar czf ../../bin/zlib-${zlib_version}.tgz usr 1230 cd ../.. 1231 tar xmzf bin/zlib-${zlib_version}.tgz -C $BUILDROOT 1232 fi 1233 1234 if test ! -d libogg-${libogg_version}/inst; then 1235 echo "### Building libogg" 1236 1237 cd libogg-${libogg_version}/ 1238 test -f Makefile || ./configure --enable-shared=no --enable-static=yes $CONFIGURE_OPTIONS 1239 make 1240 mkdir -p inst 1241 make install DESTDIR=`pwd`/inst 1242 cd inst 1243 tar czf ../../bin/libogg-${libogg_version}.tgz usr 1244 cd ../.. 1245 tar xmzf bin/libogg-${libogg_version}.tgz -C $BUILDROOT 1246 fi 1247 1248 if test ! -d libvorbis-${libvorbis_version}/inst; then 1249 echo "### Building libvorbis" 1250 1251 cd libvorbis-${libvorbis_version}/ 1252 if test "$compiler" = "cross-mingw"; then 1253 test -f Makefile || CFLAGS="$CFLAGS -g" PKG_CONFIG= ./configure --enable-shared=no --enable-static=yes --with-ogg=$thisdir/libogg-$libogg_version/inst/usr/local $CONFIGURE_OPTIONS 1254 else 1255 test -f Makefile || CFLAGS="$CFLAGS -g" ./configure --enable-shared=no --enable-static=yes --with-ogg=$thisdir/libogg-$libogg_version/inst/usr/local $CONFIGURE_OPTIONS 1256 fi 1257 make 1258 mkdir -p inst 1259 make install DESTDIR=`pwd`/inst 1260 cd inst 1261 tar czf ../../bin/libvorbis-${libvorbis_version}.tgz usr 1262 cd ../.. 1263 tar xmzf bin/libvorbis-${libvorbis_version}.tgz -C $BUILDROOT 1264 fi 1265 1266 if test ! -d flac-${libflac_version%+ds*}/inst; then 1267 echo "### Building libflac" 1268 1269 cd flac-${libflac_version%+ds*}/ 1270 autoreconf -i 1271 configure_args="--enable-shared=no --enable-static=yes --with-ogg=$thisdir/libogg-$libogg_version/inst/usr/local --disable-thorough-tests --disable-doxygen-docs --disable-xmms-plugin $FLAC_BUILD_OPTION $CONFIGURE_OPTIONS" 1272 if test $kernel = "Darwin"; then 1273 configure_args="$configure_args --disable-asm-optimizations" 1274 elif test $kernel = "MINGW" || test "$compiler" = "cross-mingw"; then 1275 # Avoid having to ship with libssp-0.dll 1276 configure_args="$configure_args --disable-stack-smash-protection --disable-fortify-source" 1277 fi 1278 test -f Makefile || ./configure $configure_args 1279 # On msys32, an error "changed before entering" occurred, can be fixed by 1280 # modifying /usr/share/perl5/core_perl/File/Path.pm 1281 # my $Need_Stat_Check = !($^O eq 'MSWin32' || $^O eq 'msys'); 1282 make V=1 1283 mkdir -p inst 1284 make install DESTDIR=`pwd`/inst 1285 cd inst 1286 tar czf ../../bin/flac-${libflac_version}.tgz usr 1287 cd ../.. 1288 tar xmzf bin/flac-${libflac_version}.tgz -C $BUILDROOT 1289 fi 1290 1291 if test ! -d id3lib-${id3lib_version}/inst && ! test $kernel = "Darwin" -a $ARCH = "arm64"; then 1292 echo "### Building id3lib" 1293 1294 cd id3lib-${id3lib_version}/ 1295 if test $kernel = "MINGW" || test "$compiler" = "cross-mingw"; then 1296 sed -i 's/^@ID3_NEEDDEBUG_TRUE@ID3_DEBUG_LIBS = -lcwd -lbfd -liberty$/@ID3_NEEDDEBUG_TRUE@ID3_DEBUG_LIBS =/' examples/Makefile.in 1297 fi 1298 autoconf 1299 configure_args="--enable-shared=no --enable-static=yes $ID3LIB_BUILD_OPTION $CONFIGURE_OPTIONS" 1300 if test $kernel = "MINGW"; then 1301 configure_args="$configure_args --build=mingw32" 1302 fi 1303 test -f Makefile || CPPFLAGS=-I/usr/local/include LDFLAGS="$LDFLAGS -L/usr/local/lib" ./configure $configure_args 1304 SED=sed make 1305 mkdir -p inst 1306 make install DESTDIR=`pwd`/inst 1307 cd inst 1308 tar czf ../../bin/id3lib-${id3lib_version}.tgz usr 1309 cd ../.. 1310 tar xmzf bin/id3lib-${id3lib_version}.tgz -C $BUILDROOT 1311 fi 1312 1313 if test ! -d utfcpp-${utfcpp_version}/inst; then 1314 echo "### Building utfcpp" 1315 1316 cd utfcpp-${utfcpp_version}/ 1317 test -f Makefile || eval cmake $CMAKE_BUILD_OPTION $CMAKE_OPTIONS -DUTF8_TESTS=OFF 1318 make VERBOSE=1 1319 mkdir -p inst 1320 make install DESTDIR=`pwd`/inst 1321 fixcmakeinst 1322 cd inst 1323 tar czf ../../bin/utfcpp-${utfcpp_version}.tgz usr 1324 cd ../.. 1325 tar xmzf bin/utfcpp-${utfcpp_version}.tgz -C $BUILDROOT 1326 fi 1327 1328 if test ! -d taglib-${taglib_version}/inst; then 1329 echo "### Building taglib" 1330 1331 cd taglib-${taglib_version}/ 1332 test -f Makefile || eval cmake -DBUILD_SHARED_LIBS=OFF $TAGLIB_ZLIB_ROOT_OPTION $CMAKE_BUILD_OPTION $CMAKE_OPTIONS -DCMAKE_PREFIX_PATH=$BUILDROOT/usr/local 1333 make VERBOSE=1 1334 mkdir -p inst 1335 make install DESTDIR=`pwd`/inst 1336 fixcmakeinst 1337 cd inst 1338 tar czf ../../bin/taglib-${taglib_version}.tgz usr 1339 cd ../.. 1340 tar xmzf bin/taglib-${taglib_version}.tgz -C $BUILDROOT 1341 fi 1342 1343 if test ! -d ffmpeg-${ffmpeg_version}/inst; then 1344 echo "### Building ffmpeg" 1345 1346 cd ffmpeg-${ffmpeg_version} 1347 # configure needs yasm and pr 1348 # On msys, make >= 3.81 is needed. 1349 # Most options taken from 1350 # http://oxygene.sk/lukas/2011/04/minimal-audio-only-ffmpeg-build-with-mingw32/ 1351 # Disable-sse avoids a SEGFAULT under MinGW. 1352 # Later versions (tested with libav-HEAD-5d2be71) do not have 1353 # --enable-ffmpeg and additionally need --disable-mmx --disable-mmxext. 1354 # The two --disable-hwaccel were added for MinGW-builds GCC 4.7.2. 1355 # The --extra-cflags=-march=i486 is to avoid error "Threading is enabled, but 1356 # there is no implementation of atomic operations available", libav bug 471. 1357 if test "$compiler" = "cross-mingw"; then 1358 # mkstemp is not available when building on Windows 1359 sed -i 's/check_func mkstemp/disable mkstemp/' ./configure 1360 sed -i 's/^\(.*-Werror=missing-prototypes\)/#\1/' ./configure 1361 AV_CONFIGURE_OPTIONS="--cross-prefix=${_crossprefix} --arch=x86 --target-os=mingw32 --sysinclude=/usr/${cross_host}/include" 1362 if test -n "${cross_host##x86_64*}"; then 1363 AV_CONFIGURE_OPTIONS="$AV_CONFIGURE_OPTIONS --extra-cflags=-march=i486" 1364 else 1365 AV_CONFIGURE_OPTIONS="$AV_CONFIGURE_OPTIONS --extra-ldflags=-lbcrypt" 1366 fi 1367 test -n "$CC" && AV_CONFIGURE_OPTIONS="$AV_CONFIGURE_OPTIONS --cc=$CC" 1368 test -n "$CXX" && AV_CONFIGURE_OPTIONS="$AV_CONFIGURE_OPTIONS --cxx=$CXX" 1369 elif test $kernel = "MINGW"; then 1370 # mkstemp is not available when building with mingw from Qt 1371 sed -i 's/check_func mkstemp/disable mkstemp/' ./configure 1372 if ! [[ $(uname) =~ ^MINGW64 ]]; then 1373 AV_CONFIGURE_OPTIONS="--extra-cflags=-march=i486" 1374 else 1375 AV_CONFIGURE_OPTIONS="--extra-ldflags=-lbcrypt" 1376 fi 1377 if test $(uname) = "MSYS_NT-6.1"; then 1378 AV_CONFIGURE_OPTIONS="$AV_CONFIGURE_OPTIONS --target-os=mingw32" 1379 fi 1380 elif test "$compiler" = "cross-macos"; then 1381 AV_CONFIGURE_OPTIONS="--disable-iconv --enable-cross-compile --cross-prefix=${_crossprefix} --arch=x86 --target-os=darwin --cc=$CC --cxx=$CXX" 1382 elif test "$compiler" = "gcc-debug" || test "$compiler" = "gcc-self-contained"; then 1383 test -n "$CC" && AV_CONFIGURE_OPTIONS="$AV_CONFIGURE_OPTIONS --cc=$CC" 1384 test -n "$CXX" && AV_CONFIGURE_OPTIONS="$AV_CONFIGURE_OPTIONS --cxx=$CXX" 1385 fi 1386 if test $kernel = "Darwin" || test $kernel = "MINGW"; then 1387 AV_CONFIGURE_OPTIONS="$AV_CONFIGURE_OPTIONS --disable-iconv" 1388 fi 1389 AV_CONFIGURE_OPTIONS="$AV_CONFIGURE_OPTIONS $AV_BUILD_OPTION" 1390 ./configure \ 1391 --disable-shared \ 1392 --enable-static \ 1393 --disable-avdevice \ 1394 --disable-avfilter \ 1395 --disable-pthreads \ 1396 --disable-swscale \ 1397 --disable-network \ 1398 --disable-muxers \ 1399 --disable-demuxers \ 1400 --disable-sse \ 1401 --disable-doc \ 1402 --enable-rdft \ 1403 --enable-demuxer=aac \ 1404 --enable-demuxer=ac3 \ 1405 --enable-demuxer=ape \ 1406 --enable-demuxer=asf \ 1407 --enable-demuxer=flac \ 1408 --enable-demuxer=matroska_audio \ 1409 --enable-demuxer=mp3 \ 1410 --enable-demuxer=mpc \ 1411 --enable-demuxer=mov \ 1412 --enable-demuxer=mpc8 \ 1413 --enable-demuxer=ogg \ 1414 --enable-demuxer=tta \ 1415 --enable-demuxer=wav \ 1416 --enable-demuxer=wv \ 1417 --disable-bsfs \ 1418 --disable-filters \ 1419 --disable-parsers \ 1420 --enable-parser=aac \ 1421 --enable-parser=ac3 \ 1422 --enable-parser=mpegaudio \ 1423 --disable-protocols \ 1424 --enable-protocol=file \ 1425 --disable-indevs \ 1426 --disable-outdevs \ 1427 --disable-encoders \ 1428 --disable-decoders \ 1429 --enable-decoder=aac \ 1430 --enable-decoder=ac3 \ 1431 --enable-decoder=alac \ 1432 --enable-decoder=ape \ 1433 --enable-decoder=flac \ 1434 --enable-decoder=mp1 \ 1435 --enable-decoder=mp2 \ 1436 --enable-decoder=mp3 \ 1437 --enable-decoder=mpc7 \ 1438 --enable-decoder=mpc8 \ 1439 --enable-decoder=tta \ 1440 --enable-decoder=vorbis \ 1441 --enable-decoder=wavpack \ 1442 --enable-decoder=wmav1 \ 1443 --enable-decoder=wmav2 \ 1444 --enable-decoder=pcm_alaw \ 1445 --enable-decoder=pcm_dvd \ 1446 --enable-decoder=pcm_f32be \ 1447 --enable-decoder=pcm_f32le \ 1448 --enable-decoder=pcm_f64be \ 1449 --enable-decoder=pcm_f64le \ 1450 --enable-decoder=pcm_s16be \ 1451 --enable-decoder=pcm_s16le \ 1452 --enable-decoder=pcm_s16le_planar \ 1453 --enable-decoder=pcm_s24be \ 1454 --enable-decoder=pcm_daud \ 1455 --enable-decoder=pcm_s24le \ 1456 --enable-decoder=pcm_s32be \ 1457 --enable-decoder=pcm_s32le \ 1458 --enable-decoder=pcm_s8 \ 1459 --enable-decoder=pcm_u16be \ 1460 --enable-decoder=pcm_u16le \ 1461 --enable-decoder=pcm_u24be \ 1462 --enable-decoder=pcm_u24le \ 1463 --enable-decoder=rawvideo \ 1464 --disable-videotoolbox \ 1465 --disable-vaapi \ 1466 --disable-vdpau \ 1467 --disable-hwaccel=h264_dxva2 \ 1468 --disable-hwaccel=mpeg2_dxva2 $AV_CONFIGURE_OPTIONS 1469 make V=1 1470 mkdir -p inst 1471 make install DESTDIR=`pwd`/inst 1472 cd inst 1473 tar czf ../../bin/ffmpeg-${ffmpeg_version}.tgz usr 1474 cd ../.. 1475 tar xmzf bin/ffmpeg-${ffmpeg_version}.tgz -C $BUILDROOT 1476 fi 1477 1478 if test ! -d chromaprint-${chromaprint_version}/inst; then 1479 echo "### Building chromaprint" 1480 1481 # The zlib library path was added for MinGW-builds GCC 4.7.2. 1482 cd chromaprint-${chromaprint_version}/ 1483 test -f Makefile || eval cmake -DBUILD_SHARED_LIBS=OFF -DBUILD_TESTS=OFF $CHROMAPRINT_ZLIB_OPTION -DFFMPEG_ROOT=$thisdir/ffmpeg-${ffmpeg_version}/inst/usr/local $CMAKE_BUILD_OPTION $CMAKE_OPTIONS 1484 make VERBOSE=1 1485 mkdir -p inst 1486 make install DESTDIR=`pwd`/inst 1487 fixcmakeinst 1488 cd inst 1489 tar czf ../../bin/chromaprint-${chromaprint_version}.tgz usr 1490 cd ../.. 1491 tar xmzf bin/chromaprint-${chromaprint_version}.tgz -C $BUILDROOT 1492 fi 1493 1494 if test ! -d mp4v2-${mp4v2_version}/inst; then 1495 echo "### Building mp4v2" 1496 1497 cd mp4v2-${mp4v2_version}/ 1498 test -f Makefile || eval cmake -DBUILD_SHARED=OFF -DBUILD_UTILS=OFF -DBUILD_SHARED_LIBS=OFF $CMAKE_BUILD_OPTION $CMAKE_OPTIONS 1499 make VERBOSE=1 1500 mkdir -p inst 1501 make install DESTDIR=`pwd`/inst 1502 fixcmakeinst 1503 cd inst 1504 tar czf ../../bin/mp4v2-${mp4v2_version}.tgz usr 1505 cd ../.. 1506 tar xmzf bin/mp4v2-${mp4v2_version}.tgz -C $BUILDROOT 1507 fi 1508 1509 fi # cross-android, else 1510 fi # libs 1511 1512 if [[ $target = *"package"* ]]; then 1513 1514 if test "$compiler" = "cross-android"; then 1515 1516 if ! test -d kid3; then 1517 echo "### Creating kid3 build directory" 1518 mkdir kid3 1519 test -e $HOME/Development/ufleisch-release-key.keystore && cp -s $HOME/Development/ufleisch-release-key.keystore kid3/ 1520 cat >kid3/run-cmake.sh <<EOF 1521 #!/bin/bash 1522 _java_root=$_java_root 1523 _android_sdk_root=$_android_sdk_root 1524 _android_ndk_root=$_android_ndk_root 1525 _android_platform=$_android_platform 1526 _android_ccache=$_android_ccache 1527 _android_abi=$_android_abi 1528 _android_qt_root=$_android_qt_root 1529 _android_keystore_path=\$(pwd)/ufleisch-release-key.keystore 1530 _android_keystore_alias=ufleisch_android 1531 if ! test -f "\$_android_keystore_path"; then 1532 _android_keystore_path= 1533 _android_keystore_alias= 1534 fi 1535 _buildprefix=\$(cd ..; pwd)/buildroot/usr/local 1536 cmake -GNinja -DJAVA_HOME=\$_java_root -DQT_ANDROID_SDK_ROOT=\$_android_sdk_root -DANDROID_SDK_ROOT=\$_android_sdk_root -DANDROID_NDK=\$_android_ndk_root -DAPK_ALL_TARGET=OFF -DANDROID_ABI=\$_android_abi -DANDROID_EXTRA_LIBS_DIR=\$_buildprefix/lib -DANDROID_KEYSTORE_PATH=\$_android_keystore_path -DANDROID_KEYSTORE_ALIAS=\$_android_keystore_alias -DCMAKE_TOOLCHAIN_FILE=$_android_toolchain_cmake -DANDROID_PLATFORM=$_android_platform -DANDROID_CCACHE=$_android_ccache -DQT_QMAKE_EXECUTABLE=\$_android_qt_root/bin/qmake -DQT_HOST_PATH=${QTBINARYDIR%/bin} -DCMAKE_BUILD_TYPE=Release -DCMAKE_FIND_ROOT_PATH=\$_buildprefix -DDOCBOOK_XSL_DIR=${_docbook_xsl_dir} -DPYTHON_EXECUTABLE=/usr/bin/python -DXSLTPROC=/usr/bin/xsltproc -DGZIP_EXECUTABLE=/bin/gzip $srcdir 1537 EOF 1538 chmod +x kid3/run-cmake.sh 1539 fi 1540 1541 else # cross-android 1542 1543 if ! test -d kid3; then 1544 echo "### Creating kid3 build directory" 1545 1546 mkdir kid3 1547 if test "$compiler" = "cross-mingw"; then 1548 cat >kid3/run-cmake.sh <<EOF 1549 #!/bin/bash 1550 cmake -GNinja $CMAKE_BUILD_OPTION -DCMAKE_TOOLCHAIN_FILE=$thisdir/mingw.cmake -DCMAKE_INSTALL_PREFIX= -DCMAKE_CXX_FLAGS="-g -O2 -DMP4V2_USE_STATIC_LIB -DID3LIB_LINKOPTION=1 -DFLAC__NO_DLL -DTAGLIB_STATIC" -DWITH_FFMPEG=ON -DWITH_MP4V2=ON -DDOCBOOK_XSL_DIR=${_docbook_xsl_dir} ../../kid3 1551 EOF 1552 elif test "$compiler" = "cross-macos"; then 1553 cat >kid3/run-cmake.sh <<EOF 1554 #!/bin/bash 1555 test -z \${PATH##$osxprefix/*} || PATH=$osxprefix/bin:$osxsdk/usr/bin:\$PATH 1556 cmake -GNinja $CMAKE_BUILD_OPTION -DCMAKE_TOOLCHAIN_FILE=$thisdir/osxcross.cmake -DCMAKE_INSTALL_PREFIX= -DCMAKE_CXX_FLAGS="-g -O2 -DMP4V2_USE_STATIC_LIB" -DWITH_FFMPEG=ON -DWITH_MP4V2=ON -DDOCBOOK_XSL_DIR=${_docbook_xsl_dir} ../../kid3 1557 EOF 1558 elif test "$compiler" = "gcc-self-contained"; then 1559 if test -n "$QTPREFIX"; then 1560 _qt_prefix=$QTPREFIX 1561 else 1562 for d in /opt/qt5/${qt_version}/gcc_64 /opt/qt5/Qt${qt_version}/${qt_version}/gcc_64 $thisdir/Qt*-linux/${qt_version}/gcc_64; do 1563 if test -d $d; then 1564 _qt_prefix=$d 1565 break 1566 fi 1567 done 1568 fi 1569 cat >kid3/run-cmake.sh <<EOF 1570 #!/bin/bash 1571 BUILDPREFIX=\$(cd ..; pwd)/buildroot/usr/local 1572 export PKG_CONFIG_PATH=\$BUILDPREFIX/lib/pkgconfig 1573 cmake -GNinja $CMAKE_BUILD_OPTION -DCMAKE_CXX_COMPILER=${gcc_self_contained_cxx} -DCMAKE_C_COMPILER=${gcc_self_contained_cc} -DQT_QMAKE_EXECUTABLE=${_qt_prefix}/bin/qmake -DWITH_READLINE=OFF -DLINUX_SELF_CONTAINED=ON -DWITH_QML=ON -DCMAKE_PREFIX_PATH=\$BUILDPREFIX -DWITH_FFMPEG=ON -DFFMPEG_ROOT=\$BUILDPREFIX -DWITH_MP4V2=ON -DWITH_APPS="Qt;CLI" -DCMAKE_INSTALL_PREFIX= -DWITH_BINDIR=. -DWITH_DATAROOTDIR=. -DWITH_DOCDIR=. -DWITH_TRANSLATIONSDIR=. -DWITH_LIBDIR=. -DWITH_PLUGINSDIR=./plugins ../../kid3 1574 EOF 1575 elif test $kernel = "Darwin" -a $ARCH = "arm64"; then 1576 _qt_prefix=${QTPREFIX:-/usr/local/Trolltech/Qt${qt_version}/${qt_version}/clang_64} 1577 cat >kid3/run-cmake.sh <<EOF 1578 #!/bin/bash 1579 INCLUDE=../buildroot/usr/local/include LIB=../buildroot/usr/local/lib cmake -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DQT_QMAKE_EXECUTABLE=${_qt_prefix}/bin/qmake -DCMAKE_INSTALL_PREFIX= -DWITH_FFMPEG=ON -DWITH_MP4V2=ON -DWITH_ID3LIB=OFF -DWITH_DOCBOOKDIR=${_docbook_xsl_dir} ../../kid3 1580 EOF 1581 elif test $kernel = "Darwin"; then 1582 _qt_prefix=${QTPREFIX:-/usr/local/Trolltech/Qt${qt_version}/${qt_version}/clang_64} 1583 cat >kid3/run-cmake.sh <<EOF 1584 #!/bin/bash 1585 INCLUDE=../buildroot/usr/local/include LIB=../buildroot/usr/local/lib cmake -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DQT_QMAKE_EXECUTABLE=${_qt_prefix}/bin/qmake -DCMAKE_INSTALL_PREFIX= -DWITH_FFMPEG=ON -DWITH_MP4V2=ON -DWITH_DOCBOOKDIR=${_docbook_xsl_dir} ../../kid3 1586 EOF 1587 elif test $kernel = "MINGW"; then 1588 _qtToolsMingw=($QTPREFIX/../../Tools/mingw*) 1589 _qtToolsMingw=$(realpath $_qtToolsMingw) 1590 cat >kid3/run-cmake.sh <<EOF 1591 #!/bin/bash 1592 INCLUDE=../buildroot/usr/local/include LIB=../buildroot/usr/local/lib cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=RelWithDebInfo -DQT_QMAKE_EXECUTABLE=${QTPREFIX}/bin/qmake -DCMAKE_INSTALL_PREFIX= -DWITH_FFMPEG=ON -DWITH_MP4V2=ON -DWITH_DOCBOOKDIR=${_docbook_xsl_dir:-$HOME/prg/docbook-xsl-1.72.0} ../../kid3 1593 EOF 1594 _qtPrefixWin=${QTPREFIX//\//\\} 1595 _qtPrefixWin=${_qtPrefixWin/\\c/C:} 1596 _qtToolsMingwWin=${_qtToolsMingw//\//\\} 1597 _qtToolsMingwWin=${_qtToolsMingwWin/\\c/C:} 1598 _docbookXslDirWin=${_docbook_xsl_dir//\//\\} 1599 _docbookXslDirWin=${_docbookXslDirWin/\\c/C:} 1600 cat >kid3/build.bat <<EOF 1601 set INCLUDE=../buildroot/usr/local/include 1602 set LIB=../buildroot/usr/local/lib 1603 echo ;%PATH%; | find /C /I ";$_qtPrefixWin\bin;" 1604 if errorlevel 1 ( 1605 path $_qtPrefixWin\bin;$_qtToolsMingwWin\bin;$_qtToolsMingwWin\opt\bin;C:\Python38;%PATH% 1606 ) 1607 cmake -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX= -DWITH_FFMPEG=ON -DWITH_MP4V2=ON -DWITH_DOCBOOKDIR=${_docbookXslDirWin:-%HOME%/prg/docbook-xsl-1.72.0} ../../kid3 1608 EOF 1609 cat >kid3/run.bat <<EOF 1610 set thisdir=%~dp0 1611 echo ;%PATH%; | find /C /I ";$_qtPrefixWin\bin;" 1612 if errorlevel 1 ( 1613 path $_qtPrefixWin\bin;$_qtToolsMingwWin\bin;$_qtToolsMingwWin\opt\bin;C:\Python38;%HOME%\prg\dumpbin;%PATH% 1614 ) 1615 echo ;%PATH%; | find /C /I ";%thisdir%src\core;" 1616 if errorlevel 1 ( 1617 path %thisdir%src\core;%thisdir%src\gui;%PATH% 1618 ) 1619 set QT_PLUGIN_PATH=$_qtPrefixWin\plugins 1620 start src\app\qt\kid3 1621 EOF 1622 elif test "$compiler" = "gcc-debug"; then 1623 cat >kid3/run-cmake.sh <<EOF 1624 #!/bin/bash 1625 BUILDPREFIX=\$(cd ..; pwd)/buildroot/usr/local 1626 export PKG_CONFIG_PATH=\$BUILDPREFIX/lib/pkgconfig 1627 cmake -GNinja -DQT_QMAKE_EXECUTABLE=${QTPREFIX:-$QT_PREFIX}/bin/qmake -DLINUX_SELF_CONTAINED=ON -DWITH_READLINE=OFF -DWITH_QML=ON -DCMAKE_CXX_FLAGS_DEBUG:STRING="-g -DMP4V2_USE_STATIC_LIB -DID3LIB_LINKOPTION=1 -DFLAC__NO_DLL -DTAGLIB_STATIC" -DCMAKE_PREFIX_PATH=\$BUILDPREFIX -DWITH_FFMPEG=ON -DFFMPEG_ROOT=\$BUILDPREFIX -DWITH_MP4V2=ON $CMAKE_BUILD_OPTION -DWITH_APPS="Qt;CLI" -DCMAKE_INSTALL_PREFIX= -DWITH_BINDIR=. -DWITH_DATAROOTDIR=. -DWITH_DOCDIR=. -DWITH_TRANSLATIONSDIR=. -DWITH_LIBDIR=. -DWITH_PLUGINSDIR=./plugins ../../kid3 1628 EOF 1629 else 1630 cat >kid3/run-cmake.sh <<EOF 1631 #!/bin/bash 1632 BUILDPREFIX=\$(cd ..; pwd)/buildroot/usr/local 1633 export PKG_CONFIG_PATH=\$BUILDPREFIX/lib/pkgconfig 1634 cmake -GNinja -DLINUX_SELF_CONTAINED=ON -DWITH_QML=ON -DCMAKE_CXX_FLAGS_DEBUG:STRING="-g -DMP4V2_USE_STATIC_LIB -DID3LIB_LINKOPTION=1 -DFLAC__NO_DLL -DTAGLIB_STATIC" -DCMAKE_PREFIX_PATH=\$BUILDPREFIX -DWITH_FFMPEG=ON -DFFMPEG_ROOT=\$BUILDPREFIX -DWITH_MP4V2=ON $CMAKE_BUILD_OPTION -DWITH_APPS="Qt;CLI" -DCMAKE_INSTALL_PREFIX= -DWITH_BINDIR=. -DWITH_DATAROOTDIR=. -DWITH_DOCDIR=. -DWITH_TRANSLATIONSDIR=. -DWITH_LIBDIR=. -DWITH_PLUGINSDIR=./plugins ../../kid3 1635 EOF 1636 fi 1637 chmod +x kid3/run-cmake.sh 1638 fi # test -d kid3 1639 1640 fi # cross-android, else 1641 1642 echo "### Building kid3 package" 1643 1644 pushd kid3 >/dev/null 1645 if test -f run-cmake.sh && ! test -f Makefile && ! test -f build.ninja; then 1646 ./run-cmake.sh 1647 fi 1648 if test "$compiler" = "cross-mingw"; then 1649 ninja 1650 _version=$(grep VERSION config.h | cut -d'"' -f2) 1651 if test -z "${cross_host##x86_64*}"; then 1652 _gccDll=libgcc_s_seh-1.dll 1653 _instdir=kid3-$_version-win32-x64 1654 else 1655 _gccDll=libgcc_s_dw2-1.dll 1656 _instdir=kid3-$_version-win32 1657 fi 1658 test -d $_instdir && rm -rf $_instdir 1659 mkdir -p $_instdir 1660 DESTDIR=$(pwd)/$_instdir ninja install/strip 1661 1662 _plugin_qt_version=$(grep "Created by.*Qt" src/plugins/musicbrainzimport/moc_musicbrainzimportplugin.cpp) 1663 _plugin_qt_version=${_plugin_qt_version##* \(Qt } 1664 _plugin_qt_version=${_plugin_qt_version%%\)*} 1665 _plugin_qt_version_nr=${_plugin_qt_version//./} 1666 if test $_plugin_qt_version_nr -gt ${qt_version//./}; then 1667 echo "Plugin Qt version $_plugin_qt_version is larger than Qt version $qt_version." 1668 echo "Loading plugins will fail!" 1669 exit 1 1670 fi 1671 1672 cp -f translations/*.qm doc/*/kid3*.html $_instdir 1673 1674 _qtBinDir=${QTPREFIX}/bin 1675 for f in Qt${qt_version_major}Core.dll Qt${qt_version_major}Network.dll Qt${qt_version_major}Gui.dll Qt${qt_version_major}Xml.dll Qt${qt_version_major}Widgets.dll Qt${qt_version_major}Multimedia.dll Qt${qt_version_major}Qml.dll Qt${qt_version_major}Quick.dll $_gccDll libstdc++-6.dll libwinpthread-1.dll; do 1676 cp $_qtBinDir/$f $_instdir 1677 done 1678 1679 _qtTranslationsDir=${QTPREFIX}/translations 1680 for f in translations/*.qm; do 1681 l=${f#*_}; 1682 l=${l%.qm}; 1683 test -f $_qtTranslationsDir/qtbase_$l.qm && cp $_qtTranslationsDir/qtbase_$l.qm $_instdir 1684 done 1685 1686 rm -f $_instdir.zip 1687 7z a $_instdir.zip $_instdir 1688 elif test "$compiler" = "cross-macos"; then 1689 test -z ${PATH##$osxprefix/*} || PATH=$osxprefix/bin:$osxsdk/usr/bin:$PATH 1690 rm -rf inst 1691 DESTDIR=$(pwd)/inst ninja install/strip 1692 ln -s /Applications inst/Applications 1693 genisoimage -V "Kid3" -D -R -apple -no-pad -o uncompressed.dmg inst 1694 _version=$(grep VERSION config.h | cut -d'"' -f2) 1695 dmg dmg uncompressed.dmg kid3-$_version-Darwin.dmg 1696 rm uncompressed.dmg 1697 elif test "$compiler" = "cross-android"; then 1698 export JAVA_HOME=$(grep _java_root= run-cmake.sh | cut -d'=' -f2) 1699 export QT_ANDROID_KEYSTORE_PATH=$(grep ANDROID_KEYSTORE_PATH CMakeCache.txt | cut -d= -f2) 1700 export QT_ANDROID_KEYSTORE_ALIAS=$(grep ANDROID_KEYSTORE_ALIAS CMakeCache.txt | cut -d= -f2) 1701 # Interactive input is not possible when building with Ninja. 1702 # Prompt the user for the password at the beginning. To avoid this prompt, 1703 # define the QT_ANDROID_KEYSTORE_STORE_PASS environment variable. 1704 if test -n "$QT_ANDROID_KEYSTORE_PATH" && test -n "$QT_ANDROID_KEYSTORE_ALIAS" && 1705 test -z "${QT_ANDROID_KEYSTORE_STORE_PASS+x}"; then 1706 read -p 'Android signing password: ' -s QT_ANDROID_KEYSTORE_STORE_PASS 1707 echo 1708 export QT_ANDROID_KEYSTORE_STORE_PASS 1709 fi 1710 ninja apk 1711 _version=$(grep VERSION config.h | cut -d'"' -f2) 1712 for prefix in android/build/outputs/apk/release/android-release android/build/outputs/apk/android-release android/bin/QtApp-release android/android-build/build/outputs/apk/release/android-build-release android/android-build/build/outputs/apk/debug/android-build-debug; do 1713 for suffix in signed unsigned; do 1714 _apkpath=${prefix}-${suffix}.apk 1715 if test -f $_apkpath; then 1716 cp -a $_apkpath kid3-$_version-android.apk 1717 break 2 1718 fi 1719 done 1720 done 1721 elif test "$compiler" = "gcc-self-contained"; then 1722 ninja package 1723 _tgz=(kid3-*-Linux.tar.gz) 1724 test -f "$_tgz" && mv $_tgz ${_tgz%%tar.gz}tgz 1725 elif test "$compiler" = "gcc-debug"; then 1726 ninja 1727 else 1728 if test -f build.ninja; then 1729 ninja package 1730 else 1731 make package 1732 fi 1733 fi 1734 popd >/dev/null 1735 fi # package 1736 1737 echo "### Built successfully"