From 35b748c46c57e553b526ae4b106270f752b4acf3 Mon Sep 17 00:00:00 2001 From: rejbasket <39080670+rejbasket@users.noreply.github.com> Date: Mon, 18 Apr 2022 10:59:42 +0200 Subject: Pkg inkscape check (#1622) * add warning if Inkscape not installed (mac) enable local build with arm linux and mac Authored-by: rejbasket --- bin/build-distribution-archives | 23 +++++++++++++++++------ bin/build-electron | 11 ++++++++++- bin/build-python | 13 ++++++------- 3 files changed, 33 insertions(+), 14 deletions(-) (limited to 'bin') diff --git a/bin/build-distribution-archives b/bin/build-distribution-archives index d20a9a17..a4129e83 100755 --- a/bin/build-distribution-archives +++ b/bin/build-distribution-archives @@ -1,5 +1,6 @@ VERSION="$(echo ${GITHUB_REF} | sed -e 's|refs/heads/||' -e 's|refs/tags/||' -e 's|/|-|g')" OS="${BUILD:-$(uname)}" +ARCH="$(uname -m)" mkdir artifacts if [ "$BUILD" = "osx" ]; then @@ -7,9 +8,19 @@ if [ "$BUILD" = "osx" ]; then # adding version to Info.plist sed -i '' 's/0.0.0/'${VERSION}'/' dist/inkstitch.app/Contents/Info.plist rm -rf dist/inkstitch/ - temp_path="/tmp/inkstitch/" + # Install location for pkgbuild + PKG_INSTALL_PATH="/tmp/inkstitch/" + # Checking arch of macos and setting path of electron for arm64 or intel + echo "Checking for macOS arch." + if [ "${ARCH}" = "arm64" ]; then + ELECTRON_BUILD_PATH="electron/build/mac-arm64" + echo "found arm64" + else + ELECTRON_BUILD_PATH="electron/build/mac" + echo "found intel" + fi # inside the scripts folder are: - # - preinstaller (checks for previously installed inkstitch and deletes it) and + # - preinstaller (checks for previously installed inkstitch and deletes it, Inkscape check with error message) and # - postinstaller (moves inkstitch folder from /tmp to user Inkscape extensions folder in $HOME) # The postinstaller is a workaround for a proper way to install in user $HOME space @@ -23,7 +34,7 @@ if [ "$BUILD" = "osx" ]; then DEV_IDENT="Developer ID Application: Lex Neva (929A568N58)" echo "Signing of inkstitch.app" # Coyping inkstitch-gui.app into inkstitch - ditto electron/build/mac dist/inkstitch.app/Contents/MacOS/electron + ditto "${ELECTRON_BUILD_PATH}" dist/inkstitch.app/Contents/MacOS/electron # signing the binary may fix notary issue /usr/bin/codesign -s "${DEV_IDENT}" \ --deep \ @@ -49,7 +60,7 @@ if [ "$BUILD" = "osx" ]; then --identifier org.inkstitch.installer \ --version ${VERSION} \ --scripts installer_scripts/scripts \ - --install-location ${temp_path}inkstitch.app \ + --install-location ${PKG_INSTALL_PATH}inkstitch.app \ artifacts/inkstitch-${VERSION}-${OS}.pkg if [[ "${GITHUB_REF}" =~ ^refs/tags/v[0-9.]+$ || $NOTARIZE_DEVELOPMENT_BUILDS == true ]]; then echo "Notary starting" @@ -61,14 +72,14 @@ if [ "$BUILD" = "osx" ]; then fi else # local builds will not be signed or notarized - cp -a electron/build/mac dist/inkstitch.app/Contents/MacOS/electron + cp -a "${ELECTRON_BUILD_PATH}" dist/inkstitch.app/Contents/MacOS/electron pkgbuild --root dist/inkstitch.app \ --component-plist installer_scripts/inkstitch.plist \ --ownership recommended \ --identifier org.inkstitch.installer \ --version ${VERSION} \ --scripts installer_scripts/scripts \ - --install-location ${temp_path}inkstitch.app \ + --install-location ${PKG_INSTALL_PATH}inkstitch.app \ artifacts/inkstitch-${VERSION}-${OS}.pkg fi # Creating the zip for Drag n' Drop install diff --git a/bin/build-electron b/bin/build-electron index 9fdb88ae..b0e93572 100755 --- a/bin/build-electron +++ b/bin/build-electron @@ -2,11 +2,20 @@ set -e set -x +ARCH="$(uname -m)" +# Check for cpu arch to build mac and linux electron arch +if [[ "$ARCH" = "arm64" ]] || [[ "$ARCH" = "aarch64" ]]; then + echo "Found ARM" + sed -i'' -e 's/CPU_ARCH/'arm64'/' electron/package.json +else + echo "Found x64" + sed -i'' -e 's/CPU_ARCH/'x64'/' electron/package.json +fi if [ "$BUILD" = "windows" ]; then args="-w --ia32" elif [ "$BUILD" = "linux" ]; then - args="-l --x64" + args="-l" elif [ "$BUILD" = "osx" ]; then cp installer_scripts/electron-entitlements.plist electron/build/ args="-m" diff --git a/bin/build-python b/bin/build-python index e84e84a5..195248c3 100755 --- a/bin/build-python +++ b/bin/build-python @@ -3,13 +3,12 @@ set -e info_year=$( date "+%Y" ) site_packages="$(python -c "import os; print(os.path.dirname(os.__file__) + '/site-packages')")" - +arch=$(uname -m) if [ "$BUILD" = "linux" ]; then - # pyinstaller misses these - pyinstaller_args+="--add-binary /usr/lib/x86_64-linux-gnu/gio/modules/libgiolibproxy.so:. " - pyinstaller_args+="--add-binary /usr/lib/x86_64-linux-gnu/libproxy.so.1:. " - pyinstaller_args+="--add-binary /lib/x86_64-linux-gnu/libnsl.so.1:. " - pyinstaller_args+="--add-binary /usr/lib/x86_64-linux-gnu/libxcb.so.1:. " + pyinstaller_args+="--add-binary /usr/lib/"$arch"-linux-gnu/gio/modules/libgiolibproxy.so:. " + pyinstaller_args+="--add-binary /usr/lib/"$arch"-linux-gnu/libproxy.so.1:. " + pyinstaller_args+="--add-binary /lib/"$arch"-linux-gnu/libnsl.so.1:. " + pyinstaller_args+="--add-binary /usr/lib/"$arch"-linux-gnu/libxcb.so.1:. " fi # This one's tricky. ink/stitch doesn't actually _use_ gi.repository.Gtk, @@ -41,7 +40,7 @@ if [ "$BUILD" = "osx" ]; then pyinstaller_args+="--osx-bundle-identifier org.inkstitch.app " pyinstaller_args+="-i electron/build/icons/mac/inkstitch.icns" if [[ -z ${GITHUB_REF} ]]; then - : + echo "Dev or Local Build" else bash bin/import-macos-keys fi -- cgit v1.2.3