File indexing completed on 2024-05-19 15:24:57
0001 #!/bin/bash 0002 0003 0004 ROOT="$(dirname "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")")" 0005 ACTION="${1:-build}" 0006 PY_VERSION="$(python --version 2>/dev/null | grep -Eo '[0-9]+\.[0-9]+' || echo 3.11)" 0007 BUILD_DIR="$ROOT/build" 0008 0009 set -ex 0010 0011 case "$ACTION" in 0012 deps) 0013 pacman --noconfirm -S \ 0014 git zip base-devel \ 0015 unzip \ 0016 mingw-w64-x86_64-qt6 \ 0017 mingw-w64-x86_64-zlib \ 0018 mingw-w64-x86_64-cmake \ 0019 mingw-w64-x86_64-python \ 0020 mingw-w64-x86_64-potrace \ 0021 mingw-w64-x86_64-ffmpeg \ 0022 mingw-w64-x86_64-toolchain \ 0023 mingw-w64-x86_64-python-pip \ 0024 mingw-w64-x86_64-libarchive \ 0025 mingw-w64-x86_64-libimagequant 0026 ;; 0027 0028 configure) 0029 SUFFIX="$2" 0030 mkdir -p "$BUILD_DIR" 0031 cd "$BUILD_DIR" 0032 0033 cmake.exe .. \ 0034 -DQt6_DIR=/mingw64/lib/cmake/Qt6 \ 0035 -DZLIB_LIBRARY=/mingw64/lib/libz.a \ 0036 -DCMAKE_PREFIX_PATH='/mingw64/lib/' \ 0037 -DZLIB_INCLUDE_DIR=/mingw64/include \ 0038 -DPython3_PREFIX=/mingw64/ \ 0039 -DPython3_LIBRARIES=/mingw64/bin/libpython$PY_VERSION.dll \ 0040 -DPython3_EXECUTABLE=/mingw64/bin/python3 \ 0041 -G 'MSYS Makefiles' \ 0042 -DCMAKE_BUILD_TYPE=Release \ 0043 -DCMAKE_INSTALL_PREFIX='' \ 0044 -DVERSION_SUFFIX="$SUFFIX" 0045 ;; 0046 0047 build) 0048 JOBS="${2:-4}" 0049 cd "$BUILD_DIR" 0050 mingw32-make.exe -j$JOBS || mingw32-make.exe VERBOSE=1 0051 0052 # Setup package 0053 PACKDIR=glaxnimate 0054 mingw32-make.exe translations VERBOSE=1 0055 mingw32-make.exe install DESTDIR=$PACKDIR >/dev/null 0056 windeployqt-qt6.exe $PACKDIR/bin/glaxnimate.exe || true 0057 0058 # Copy dependencies, needs to run a couple times to pick everything up *shrugs* 0059 # echo ===== 0060 # ldd.exe --version 0061 # ldd.exe $PACKDIR/bin/glaxnimate.exe 0062 # for i in {0..3} 0063 # do 0064 # echo "Adding" 0065 # ldd.exe $PACKDIR/bin/glaxnimate.exe | sed -rn 's/.* => (.*\/mingw64\/bin\/\S+).*/\1/p' 0066 # ldd.exe $PACKDIR/bin/glaxnimate.exe | sed -rn 's/.* => (.*\/mingw64\/bin\/\S+).*/\1/p' | xargs -i cp {} $PACKDIR/bin 0067 # done 0068 # echo "." 0069 # Dunno why but the above doesn't work on CI (it does work locally *shrugs*) 0070 cp /mingw64/bin/*.dll $PACKDIR/bin 0071 0072 cp ./external/Qt-Color-Widgets/libQtColorWidgets.dll $PACKDIR/bin 0073 cp ../deploy/glaxnimate.vbs $PACKDIR 0074 mkdir -p $PACKDIR/share/glaxnimate/glaxnimate/pythonhome/lib/python 0075 pacman --noconfirm -S mingw-w64-x86_64-python3-pillow 0076 cp -r \ 0077 /mingw64/lib/python$PY_VERSION/*.py \ 0078 /mingw64/lib/python$PY_VERSION/lib-dynload/* \ 0079 /mingw64/lib/python$PY_VERSION/{json,collections,encodings,logging,urllib,re} \ 0080 $PACKDIR/share/glaxnimate/glaxnimate/pythonhome/lib/python 0081 # mkdir /tmp/PyInstall 0082 # pip install pillow --prefix /tmp/PyInstall 0083 # mv /tmp/PyInstall/lib/python$PY_VERSION/site-packages/PIL $PACKDIR/share/glaxnimate/glaxnimate/pythonhome/lib/python 0084 0085 # Create Artifacts 0086 zip -r glaxnimate-x86_64.zip glaxnimate >/dev/null 0087 sha1sum glaxnimate-x86_64.zip >checksum.txt 0088 0089 ;; 0090 0091 deploy) 0092 BRANCH="${2:-master}" 0093 SSH_ARGS="$3" 0094 0095 pacman --noconfirm -S rsync 0096 0097 if [ "$BRANCH" = master -o "$BRANCH" = github ] 0098 then 0099 path=master 0100 channel="windows-beta" 0101 else 0102 path="$BRANCH" 0103 channel="windows-stable" 0104 fi 0105 0106 cd "$BUILD_DIR" 0107 version="$(../deploy/get_version.sh CMakeCache.txt)" 0108 0109 mkdir -p "artifacts/$path/Win" 0110 mv glaxnimate-x86_64.zip "artifacts/$path/Win" 0111 mv checksum.txt "artifacts/$path/Win" 0112 cd artifacts 0113 0114 0115 # Upload SourceForge 0116 rsync -vv -a "$path" mbasaglia@frs.sourceforge.net:/home/frs/project/glaxnimate/ -e "ssh -o StrictHostKeyChecking=no $SSH_ARGS" 0117 ;; 0118 0119 pypi) 0120 cd "$BUILD_DIR" 0121 pip.exe install wheel twine 0122 mingw32-make.exe glaxnimate_python_depends_install 0123 mingw32-make.exe glaxnimate_python VERBOSE=1 0124 mingw32-make.exe glaxnimate_python_wheel 0125 ;; 0126 0127 *) 0128 echo " # Install dependencies" 0129 echo "win_build.sh deps" 0130 echo 0131 echo " # Configure CMake" 0132 echo "win_build.sh configure [VERSION_SUFFIX]" 0133 echo 0134 echo " # Compile / package" 0135 echo "win_build.sh build [JOBS=4]" 0136 echo 0137 echo " # Add package to artifacts" 0138 echo "win_build.sh deploy [BRANCH=master [SSH_ARGS]]" 0139 echo 0140 echo " # Build python package" 0141 echo "win_build.sh pypi" 0142 ;; 0143 esac