Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

macOS CI and installer package #2

Merged
merged 12 commits into from
Jul 26, 2020
Merged
8 changes: 8 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,13 @@ jobs:
services:
- xvfb

# macOS native build
- os: osx
compiler: gcc
env:
- TARGET="macos"
- PLUGINS="abgate artyfx blop caps fomp mda"

before_install:
- bash ${TRAVIS_BUILD_DIR}/.travis/before_install.sh

Expand All @@ -62,6 +69,7 @@ deploy:
secure: "xKXvMWEvj92IsFINpGlYEJeidLRoTeLIwrWVO06UrNNVCPiWC9z64Xthx/0xqQEv+2PA5GLkh9lnTm7aqQKbMNiVj4sQCcg3sVXEhkGkr27KNjHuQiFao+IeotU6bVTObzGhNR+US3LkRK9RSSvnmDBSUQB16+YgG6PZyXH7mQfoLycQQ8z24hLc4P2gGXbgd23viqZVxBh15HBm8jSm0q5Y5JZ2D/ETQWIijv+Cd7f3Q4j989Q4ZULiDyPs6gMR6Klr85Z8iNXEZRCw/dJ800IrWV9tetJFZFVOG2nWATPSFD9L1DLlJtD0tPJjk/n7DpUEivdrrLgm2C1MaTfDWQU7OOktkcNv6oUB++hWqD/d9bj1teSu9lrUkAS4QPWGWgsMQH/eWquoS6vQOE7ERAHTDgbsS1aPxnuWyG2lyefbSEJCXBOpbcWLAfAr3cdkS+QhFHZzKvZLwJZFkKR0FEKKPkt+CViLmtSbeM7uFRhX3B4uA9EByZonlvupgKfyt/WKoqpsb1hF16tVrZOmTFf2/btLOw8PUD1opAx0aXjH+XcWH6y93wsP41E3VMO/gc8jc7npa+JsMDXaHFf/DMQvj9rVF8deHoshx8Sl3n0RpEhMyV+lXKKfewryqnfWNGak7wNQQhFr4Xqv6mleBFAX1Miy12KkzYxltfwi53o="
file_glob: true
file: setup/inno/PawPaw-*.exe
file: setup/macos/PawPaw-*.pkg
skip_cleanup: true
on:
tags: true
Expand Down
5 changes: 5 additions & 0 deletions .travis/before_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

set -e

# nothing to do for macOS native
if [ "${TARGET}" = "macos" ]; then
exit 0
fi

sudo add-apt-repository -y ppa:kxstudio-debian/kxstudio
sudo add-apt-repository -y ppa:kxstudio-debian/toolchain

Expand Down
6 changes: 6 additions & 0 deletions .travis/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

set -e

# Special macOS native handling
if [ "${TARGET}" = "macos" ]; then
brew install cmake jq || true
exit 0
fi

# Special handling for caching deb archives
if [ "$(ls ${HOME}/PawPawBuilds/debs | wc -l)" -ne 0 ]; then
sudo cp ${HOME}/PawPawBuilds/debs/*.deb /var/cache/apt/archives/
Expand Down
55 changes: 50 additions & 5 deletions pack-plugins.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ fi

shift

VERSION=$(cat VERSION)

# ---------------------------------------------------------------------------------------------------------------------

source setup/check_target.sh
Expand Down Expand Up @@ -45,19 +47,25 @@ function create_innosetup_exe {
local pkgdir="${PAWPAW_BUILDDIR}/innosetup-6.0.5"
local iscc="${pkgdir}/drive_c/InnoSeup/ISCC.exe"

echo "#define VERSION \"$(cat VERSION)\"" > /tmp/pawpaw/version.iss
echo "#define VERSION \"${VERSION}\"" > /tmp/pawpaw/version.iss
env WINEARCH="${PAWPAW_TARGET}" WINEPREFIX="${pkgdir}" wine "${iscc}" "setup/inno/${PAWPAW_TARGET}.iss"
}

# ---------------------------------------------------------------------------------------------------------------------

rm -rf /tmp/pawpaw
mkdir /tmp/pawpaw

if [ "${WIN32}" -eq 1 ]; then
download_and_install_innosetup
rm -rf /tmp/pawpaw
mkdir /tmp/pawpaw
touch /tmp/pawpaw/components.iss
touch /tmp/pawpaw/lv2bundles.iss
PAWPAW_WINE_LV2DIR="Z:$(echo ${PAWPAW_PREFIX} | tr -t '/' '\\')\\lib\\lv2\\"

elif [ "${MACOS}" -eq 1 ] && [ "${MACOS_OLD}" -eq 0 ]; then
touch /tmp/pawpaw/choices.xml
touch /tmp/pawpaw/outlines.xml

fi

# ---------------------------------------------------------------------------------------------------------------------
Expand All @@ -71,23 +79,60 @@ for plugin in ${@}; do
fi

name=$(jq -crM .name ${pfile})
sname=$(echo ${name} | tr -t '-' '_')
sname=$(echo ${name} | tr -ds '-' '_')
lv2bundles=($(jq -crM .lv2bundles[] ${pfile}))

if [ "${WIN32}" -eq 1 ]; then
echo "Name: ${sname}; Description: \"${name}\"; Types: full;" >> /tmp/pawpaw/components.iss

elif [ "${MACOS}" -eq 1 ] && [ "${MACOS_OLD}" -eq 0 ]; then
echo " <choice id=\"studio.kx.distrho.pawpaw.${sname}\" title=\"${name}\" visible=\"true\">" >> /tmp/pawpaw/choices.xml
echo " <line choice=\"studio.kx.distrho.pawpaw.${sname}\"/>" >> /tmp/pawpaw/outlines.xml
fi

for lv2bundle in ${lv2bundles[@]}; do
if [ "${WIN32}" -eq 1 ]; then
echo "Source: \"${PAWPAW_WINE_LV2DIR}${lv2bundle}\\*\"; DestDir: \"{commoncf}\\LV2\\${lv2bundle}\"; Components: ${sname}; Flags: recursesubdirs" >> /tmp/pawpaw/lv2bundles.iss

elif [ "${MACOS}" -eq 1 ] && [ "${MACOS_OLD}" -eq 0 ]; then
bundleref="pawpaw-bundle-${sname}-${lv2bundle}.pkg"
echo " <pkg-ref id=\"studio.kx.distrho.pawpaw.${sname}_${lv2bundle}\" version=\"0\">${bundleref}</pkg-ref>" >> /tmp/pawpaw/choices.xml
pkgbuild \
--identifier "studio.kx.distrho.pawpaw.${sname}_${lv2bundle}" \
--install-location "/Library/Audio/Plug-Ins/LV2/${lv2bundle}/" \
--root "${PAWPAW_PREFIX}/lib/lv2/${lv2bundle}/" \
"setup/macos/${bundleref}"
fi
done

if [ "${MACOS}" -eq 1 ] && [ "${MACOS_OLD}" -eq 0 ]; then
echo " </choice>" >> /tmp/pawpaw/choices.xml
fi
done

if [ "${WIN32}" -eq 1 ]; then
create_innosetup_exe
rm -rf /tmp/pawpaw

elif [ "${MACOS}" -eq 1 ] && [ "${MACOS_OLD}" -eq 0 ]; then
pushd setup/macos
python -c "
with open('package.xml.in', 'r') as fh:
packagexml = fh.read()
with open('/tmp/pawpaw/choices.xml', 'r') as fh:
choicesxml = fh.read().strip()
with open('/tmp/pawpaw/outlines.xml', 'r') as fh:
outlinesxml = fh.read().strip()
print(packagexml.replace('@CURDIR@','${PWD}').replace('@CHOICES@',choicesxml).replace('@OUTLINES@',outlinesxml))" > package.xml
productbuild \
--distribution package.xml \
--identifier studio.kx.distrho.pawpaw \
--package-path "${PWD}" \
--version ${VERSION} \
PawPaw-macOS-v${VERSION}.pkg
rm package.xml pawpaw-bundle-*
popd
fi

rm -rf /tmp/pawpaw

# ---------------------------------------------------------------------------------------------------------------------
Loading