From 8c2a99b0b430528bdbb2223d1de23aa60ff2ce25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?IOhannes=20m=20zm=C3=B6lnig?= Date: Tue, 12 Nov 2019 16:37:29 +0100 Subject: [PATCH] [ci] initial config --- .git-ci/gitlab-iem.yml | 150 +++++++++++++++++++++++++++++++++++++ .git-ci/localdeps.macos.sh | 80 ++++++++++++++++++++ .git-ci/localdeps.win.sh | 58 ++++++++++++++ 3 files changed, 288 insertions(+) create mode 100644 .git-ci/gitlab-iem.yml create mode 100755 .git-ci/localdeps.macos.sh create mode 100755 .git-ci/localdeps.win.sh diff --git a/.git-ci/gitlab-iem.yml b/.git-ci/gitlab-iem.yml new file mode 100644 index 0000000..654f0ad --- /dev/null +++ b/.git-ci/gitlab-iem.yml @@ -0,0 +1,150 @@ +####################################################################### +### .git-ci/gitlab-iem.yml for Pd externals: v1.2 +### +### this can be used for any external with a build system like: +### - 'make' builds the external +### - 'make install' installs the external to be used by Pd +### the following make variables must be honoured: +### - extension: filename extension for externals +### - DESTDIR: base directory for 'make install' +### - pkglibdir: directory to put externals into (relative to DESTDIR) +### +### one well known build-system that can be used straight away is +### "pd-lib-builder" -> https://github.com/pure-data/pd-lib-builder/ +####################################################################### + +variables: + PDVERSION: 0.49-0 + +####################################################################### +### configuration templates (to be used for snapshot and release builds) +.build:snapshot: &snapshot + except: + - tags + artifacts: &snapshot_artifacts + name: ${CI_PROJECT_NAME}_${CI_COMMIT_REF_NAME}_${CI_JOB_NAME%_*} + paths: + - "${CI_PROJECT_NAME}" + expire_in: 1 week + +.build:release: &release + only: + - tags + artifacts: &release_artifacts + name: ${CI_PROJECT_NAME}_${CI_COMMIT_REF_NAME}_${CI_JOB_NAME%_*} + paths: + - "${CI_PROJECT_NAME}" + +.build:linux: &build_linux + image: gcc + stage: build + before_script: + - apt-get update && apt-get install -y --no-install-recommends make puredata-dev puredata + - if [ -e .git-ci/requirements.apt ]; then apt-get install -y --no-install-recommends $(cat .git-ci/requirements.apt | sed -e '/^#/d'); fi + - export PD=/usr/bin/pd + script: + - make + - make install DESTDIR=$(pwd) pkglibdir=/ + +.build:macos: &build_macos + tags: + - osx + stage: build + before_script: + - if [ -e .git-ci/requirements.brew ]; then brew bundle --no-upgrade --file=.git-ci/requirements.brew; fi + - wget -q -O Pd.tgz http://msp.ucsd.edu/Software/pd-${PDVERSION}.mac.tar.gz + - rm -rf /Applications/Pd*.app/ + - tar xvf Pd.tgz -C /Applications/ + - rm -f Pd.tgz + - export PD=$(find /Applications/Pd*.app/Contents/Resources/bin/ type f -name pd -print -quit) + script: + - make + - make install DESTDIR=$(pwd) pkglibdir=/ + after_script: + - if [ -x .git-ci/localdeps.macos.sh ]; then find "${CI_PROJECT_NAME}" -type f "(" -name "*.pd_darwin" -o -name "*.so" ")" -exec .git-ci/localdeps.macos.sh {} +; fi + +.build:w32: &build_w32 + stage: build + tags: + - windows + variables: + IEMCI_CONFIGURATIONS: mingw32 + before_script: + - if [ -e .git-ci/requirements.msys2 ]; then pacman --noconfirm -S --needed $(cat .git-ci/requirements.msys2 | sed -e 's|#.*||' -e "s|@MINGW@|${MINGW_PACKAGE_PREFIX}-|"); fi + - wget -q -O Pd.zip http://msp.ucsd.edu/Software/pd-${PDVERSION}-i386.msw.zip + - rm -rf "${PROGRAMFILESX86}/pd"; mkdir -p "${PROGRAMFILESX86}/pd" + - unzip -q Pd.zip -d "${PROGRAMFILESX86}/pd" + - mv -v "${PROGRAMFILESX86}/pd"/*/* "${PROGRAMFILESX86}/pd" + - export PD="${PROGRAMFILESX86}/pd/bin/pd.com" + script: + - make + - make install DESTDIR=$(pwd) pkglibdir=/ + after_script: + - if [ -x .git-ci/localdeps.win.sh ]; then find "${CI_PROJECT_NAME}" -type f "(" -name "*.m_i386" -o -name "*.dll" -o -name "*.exe" -o -name "*.com" ")" -exec .git-ci/localdeps.win.sh {} +; fi + +.build:w64: &build_w64 + stage: build + tags: + - windows + variables: + IEMCI_CONFIGURATIONS: mingw64 + before_script: + - if [ -e .git-ci/requirements.msys2 ]; then pacman --noconfirm -S --needed $(cat .git-ci/requirements.msys2 | sed -e 's|#.*||' -e "s|@MINGW@|${MINGW_PACKAGE_PREFIX}-|"); fi + - wget -q -O Pd.zip http://msp.ucsd.edu/Software/pd-${PDVERSION}.msw.zip + - rm -rf "${PROGRAMFILES}/pd"; mkdir -p "${PROGRAMFILES}/pd" + - unzip -q Pd.zip -d "${PROGRAMFILES}/pd" + - mv -v "${PROGRAMFILES}/pd"/*/* "${PROGRAMFILES}/pd" + - export PD="${PROGRAMFILES}/pd/bin/pd.com" + script: + - make extension=m_amd64 + - make install extension=m_amd64 DESTDIR=$(pwd) pkglibdir=/ + after_script: + - if [ -x .git-ci/localdeps.win.sh ]; then find "${CI_PROJECT_NAME}" -type f "(" -name "*.m_amd64" -o -name "*.dll" -o -name "*.exe" -o -name "*.com" ")" -exec .git-ci/localdeps.win.sh {} +; fi + +####################################################################### +### the actual jobs: (linux,macos,windows)*(release,snapshot) + +Linux: + <<: *build_linux + <<: *release +Darwin: + <<: *build_macos + <<: *release +w32: + <<: *build_w32 + <<: *release +w64: + <<: *build_w64 + <<: *release + + +Linux_snapshot: + <<: *build_linux + <<: *snapshot +Darwin_snapshot: + <<: *build_macos + <<: *snapshot +w32_snapshot: + <<: *build_w32 + <<: *snapshot +w64_snapshot: + <<: *build_w64 + <<: *snapshot + +####################################################################### +### create deken packages and (optionally) upload them +deken: + stage: deploy + image: debian:buster + only: + - tags + variables: + DEKEN_ROOT: "yes" + before_script: + - apt-get update && apt-get --no-install-recommends -y install deken git + script: + - chmod -R go-w . + - git archive --format=tar --prefix=tmp/${CI_PROJECT_NAME}/ HEAD | tar xf - + - deken package --version="${CI_COMMIT_TAG#v}" "tmp/${CI_PROJECT_NAME}" + - deken package --version="${CI_COMMIT_TAG#v}" "${CI_PROJECT_NAME}" + - test -z "${DEKEN_USERNAME}" || test -z "${DEKEN_PASSWORD}" || deken upload --no-source-error ./*.dek diff --git a/.git-ci/localdeps.macos.sh b/.git-ci/localdeps.macos.sh new file mode 100755 index 0000000..b53e96b --- /dev/null +++ b/.git-ci/localdeps.macos.sh @@ -0,0 +1,80 @@ +#!/bin/bash + +## puts dependencies besides the binary +# LATER: put dependencies into a separate folder + +## usage: $0 [...] + +error() { + echo "$@" 1>&2 +} +basename () { + local x=${1##*/} + if [ "x$x" = "x" ]; then + echo $1 + else + echo $x + fi +} +dirname () { + local x=${1%/*} + if [ "x$x" = "x" ]; then + echo . + else + echo $x + fi +} + +if [ "x${otool}" = "x" ]; then + otool="otool -L" +fi +if [ "x${otool}" = "x" ]; then + error "no 'otool' binary found" + exit 0 +fi + +list_deps() { + $otool "$1" \ + | grep -v ":$" \ + | grep compatibility \ + | awk '{print $1}' \ + | egrep '^/' \ + | egrep -v '^/usr/lib/' \ + | egrep -v '^/System/Library/Frameworks' +} + +install_deps () { +error "DEP: ${INSTALLDEPS_INDENT}$1" +outdir=$2 +if [ "x${outdir}" = "x" ]; then + outdir=$(dirname "$1") +fi +if [ ! -d "${outdir}" ]; then + outdir=. +fi + +list_deps "$1" | while read dep; do + infile=$(basename "$1") + depfile=$(basename "${dep}") + install_name_tool -change "${dep}" "@loader_path/${depfile}" "$1" + + if [ -e "${outdir}/${depfile}" ]; then + error "DEP: ${INSTALLDEPS_INDENT} ${dep} SKIPPED" + else + error "DEP: ${INSTALLDEPS_INDENT} ${dep} -> ${outdir}" + cp "${dep}" "${outdir}" + chmod u+w "${outdir}/${depfile}" + install_name_tool -id "@loader_path/${depfile}" "${outdir}/${depfile}" + # recursively call ourselves, to resolve higher-order dependencies + INSTALLDEPS_INDENT="${INSTALLDEPS_INDENT} " $0 "${outdir}/${depfile}" + fi +done + +} + + +for f in "$@"; do + if [ -e "${f}" ]; then + install_deps "${f}" + fi +done diff --git a/.git-ci/localdeps.win.sh b/.git-ci/localdeps.win.sh new file mode 100755 index 0000000..82fe736 --- /dev/null +++ b/.git-ci/localdeps.win.sh @@ -0,0 +1,58 @@ +#!/bin/sh + +## puts dependencies besides the binary + +## usage: $0 [...] + +error() { + echo "$@" 1>&2 +} + +NTLDD=$(which ntldd 2>/dev/null) + +if [ "x${NTLDD}" = "x" ]; then + error "no 'ntldd' binary found" + exit 0 +fi + + +list_deps() { + ${NTLDD} -R "$1" \ + | grep -i mingw \ + | awk '{print $3}' \ + | grep -i mingw \ + | sed -e 's|\\|/|g' +} + +install_deps () { +error "DEP: ${INSTALLDEPS_INDENT}$1" +outdir=$2 +if [ "x${outdir}" = "x" ]; then + outdir=$(dirname "$1") +fi +if [ ! -d "${outdir}" ]; then + outdir=. +fi + +list_deps "$1" | while read dep; do + depfile=$(basename "${dep}") + if [ -e "${outdir}/${depfile}" ]; then + error "DEP: ${INSTALLDEPS_INDENT} ${dep} SKIPPED" + else + error "DEP: ${INSTALLDEPS_INDENT} ${dep} -> ${outdir}" + cp "${dep}" "${outdir}" + chmod a-x "${outdir}/${depfile}" + + # recursively call ourselves, to resolve higher-order dependencies + INSTALLDEPS_INDENT="${INSTALLDEPS_INDENT} " $0 "${outdir}/${depfile}" + fi +done + +} + + +for f in "$@"; do + if [ -e "${f}" ]; then + install_deps "${f}" + fi +done