File indexing completed on 2024-05-19 04:19:32
0001 #!/bin/bash 0002 0003 0004 if ! (which readlink | grep -q gnu) 0005 then 0006 echo "Install GNU utils" 0007 echo "brew install coreutils ed findutils gawk gnu-sed gnu-tar grep make" 0008 echo 'export PATH="$(echo /usr/local/opt/*/libexec/gnubin | tr ' ' :):$PATH";' 0009 exit 1 0010 fi 0011 0012 ROOT="$(dirname "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")")" 0013 ACTION="${1:-build}" 0014 0015 set -ex 0016 0017 case "$ACTION" in 0018 deps) 0019 brew list cmake || brew install cmake 0020 brew list qt@5 || brew install qt@5 0021 brew upgrade python@3.9 || true 0022 brew list potrace || brew install potrace 0023 brew list ffmpeg || brew install ffmpeg 0024 brew list libarchive || brew install libarchive 0025 ;; 0026 0027 configure) 0028 SUFFIX="$2" 0029 mkdir -p "$ROOT/build" 0030 cd "$ROOT/build" 0031 cmake .. \ 0032 -DQt5_DIR="$(brew --prefix qt@5)/lib/cmake/Qt5" \ 0033 -DCMAKE_PREFIX_PATH="$(brew --prefix qt@5)/lib/cmake/Qt5Designer" \ 0034 -DLibArchive_INCLUDE_DIR="$(brew --prefix libarchive)/include" \ 0035 -DVERSION_SUFFIX="$SUFFIX" 0036 ;; 0037 0038 build) 0039 cd "$ROOT/build" 0040 JOBS="${2:-4}" 0041 make -j$JOBS 0042 make translations || make help | sort # Why does this not work on travis? 0043 mkdir -p glaxnimate.iconset 0044 cp ../data/images/glaxnimate.png glaxnimate.iconset/icon_512x512.png 0045 iconutil -c icns glaxnimate.iconset -o glaxnimate.icns 0046 0047 if [ -n "$TRAVIS_BRANCH" ] 0048 then 0049 function travis_is_a_pain() 0050 { 0051 while : 0052 do 0053 echo pain 0054 sleep 300 0055 done 0056 } 0057 travis_is_a_pain & 0058 cpack -G Bundle 0059 kill %% 0060 else 0061 cpack -G Bundle 0062 fi 0063 0064 mv Glaxnimate-*.dmg glaxnimate.dmg 0065 shasum -a 1 glaxnimate.dmg >checksum.txt 0066 ;; 0067 0068 deploy) 0069 BRANCH="${2:-master}" 0070 SSH_ARGS="$3" 0071 0072 if [ "$BRANCH" = macbuild -o "$BRANCH" = master -o "$BRANCH" = github ] 0073 then 0074 path=master 0075 channel="mac-beta" 0076 else 0077 path="$BRANCH" 0078 channel="mac-stable" 0079 fi 0080 0081 cd "$ROOT/build" 0082 mkdir -p "artifacts/$path/MacOs" 0083 cp glaxnimate.dmg "artifacts/$path/MacOs" 0084 cp checksum.txt "artifacts/$path/MacOs" 0085 cd artifacts 0086 0087 # Upload SourceForge 0088 rsync -a "$path" mbasaglia@frs.sourceforge.net:/home/frs/project/glaxnimate/ -e "ssh -o StrictHostKeyChecking=no $SSH_ARGS" 0089 ;; 0090 0091 pypi) 0092 cd "$ROOT/build" 0093 make glaxnimate_python_depends_install 0094 make glaxnimate_python 0095 libpath="$(echo 'from distutils.util import get_platform; import sys; print("lib.%s-%d.%d" % (get_platform(), *sys.version_info[:2]))' | python3)" 0096 ln -sf lib bin/python/build/$libpath 0097 make glaxnimate_python_wheel 0098 ;; 0099 0100 *) 0101 echo " # Install dependencies" 0102 echo "mac_build.sh deps" 0103 echo 0104 echo " # Configure CMake" 0105 echo "mac_build.sh configure [VERSION_SUFFIX]" 0106 echo 0107 echo " # Compile / package" 0108 echo "mac_build.sh build [JOBS=4]" 0109 echo 0110 echo " # Add package to artifacts" 0111 echo "mac_build.sh deploy [BRANCH=master [SSH_ARGS]]" 0112 echo 0113 echo " # Build python package" 0114 echo "mac_build.sh pypi" 0115 ;; 0116 esac