From b2c28cc6b64ada23377c6446169f68b1505111d1 Mon Sep 17 00:00:00 2001 From: Chris Hogan Date: Fri, 19 May 2023 14:05:34 -0600 Subject: [PATCH] chore(build): minor build updates (#829) --- .github/workflows/build-dmg-universal.yml | 11 +- .github/workflows/build-release-linux.yml | 2 + Cargo.lock | 10 +- Cargo.toml | 2 +- Makefile | 134 +++++++++++----------- ui/deb/DEBIAN/control | 10 +- ui/wix/main.wxs | 4 - 7 files changed, 85 insertions(+), 88 deletions(-) diff --git a/.github/workflows/build-dmg-universal.yml b/.github/workflows/build-dmg-universal.yml index 7137e960a62..657ed04708b 100644 --- a/.github/workflows/build-dmg-universal.yml +++ b/.github/workflows/build-dmg-universal.yml @@ -41,6 +41,7 @@ jobs: MACOS_CERTIFICATE_NAME: ${{ secrets.MACOS_CERTIFICATE_NAME }} MACOS_CI_KEYCHAIN_PWD: ${{ secrets.MACOS_KEYCHAIN_PASSWORD }} MACOS_KEYCHAIN_NAME: ${{ secrets.MACOS_KEYCHAIN_NAME }} + MACOS_CERT_ID: ${{secrets.MACOS_CERT_ID}} run: | echo $MACOS_CERTIFICATE | base64 --decode > certificate.p12 security create-keychain -p "$MACOS_CI_KEYCHAIN_PWD" builduplink.keychain @@ -51,7 +52,7 @@ jobs: security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k "$MACOS_CI_KEYCHAIN_PWD" builduplink.keychain security find-identity -p codesigning -v security list-keychains - make dmg + make dmg SIGNING_KEY="$MACOS_CERT_ID" - name: "Notarize executable" env: PROD_MACOS_NOTARIZATION_APPLE_ID: ${{ secrets.MACOS_NOTARIZATION_APPLE_ID }} @@ -62,14 +63,14 @@ jobs: echo "Create keychain profile" xcrun notarytool store-credentials "uplink-notarytool-profile" --apple-id "$PROD_MACOS_NOTARIZATION_APPLE_ID" --team-id "$PROD_MACOS_NOTARIZATION_TEAM_ID" --password "$PROD_MACOS_NOTARIZATION_PWD" echo "Creating temp notarization archive" - ditto -c -k --keepParent "target/macos_bundle/Uplink.app" "notarization.zip" + ditto -c -k --keepParent "target/release/macos/Uplink.app" "notarization.zip" echo "Notarize app" xcrun notarytool submit "notarization.zip" --keychain-profile "uplink-notarytool-profile" --wait echo "Attach staple" - xcrun stapler staple "target/macos_bundle/Uplink.app" + xcrun stapler staple "target/release/macos/Uplink.app" - name: Create ZIP archive run: | - ditto -c -k --sequesterRsrc --keepParent target/macos_bundle/Uplink.app Uplink-Mac-Universal.zip + ditto -c -k --sequesterRsrc --keepParent target/release/macos/Uplink.app Uplink-Mac-Universal.zip - name: Calculate hashes run: | shasum -a 256 Uplink-Mac-Universal.zip > Uplink-Mac-Universal.zip.sha256.txt @@ -86,4 +87,4 @@ jobs: uses: softprops/action-gh-release@v1 with: files: | - Uplink-Mac-Universal.zip + Uplink-Mac-Universal.zip \ No newline at end of file diff --git a/.github/workflows/build-release-linux.yml b/.github/workflows/build-release-linux.yml index 682104eed27..50c1ce5ce80 100644 --- a/.github/workflows/build-release-linux.yml +++ b/.github/workflows/build-release-linux.yml @@ -13,6 +13,8 @@ jobs: name: Build Release Linux runs-on: ubuntu-latest steps: + - name: Get latest package list + run: sudo apt-get update - name: Install libwebkit2gtk run: sudo apt-get install -y build-essential pkg-config libssl-dev libgtk-3-dev libwebkit2gtk-4.1-dev libayatana-appindicator3-dev librsvg2-dev librust-alsa-sys-dev dpkg-dev gzip - name: Install Protoc diff --git a/Cargo.lock b/Cargo.lock index 8b35a873b42..de18ebf2155 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1309,7 +1309,7 @@ dependencies = [ [[package]] name = "common" -version = "0.0.1" +version = "0.1.5" dependencies = [ "anyhow", "base64 0.20.0", @@ -2443,7 +2443,7 @@ dependencies = [ [[package]] name = "extensions" -version = "0.0.1" +version = "0.1.5" dependencies = [ "derive_more", "dioxus", @@ -3685,7 +3685,7 @@ dependencies = [ [[package]] name = "icons" -version = "0.0.1" +version = "0.1.5" dependencies = [ "dioxus", "dioxus-html", @@ -4135,7 +4135,7 @@ dependencies = [ [[package]] name = "kit" -version = "0.0.1" +version = "0.1.5" dependencies = [ "chrono", "common", @@ -8738,7 +8738,7 @@ checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" [[package]] name = "uplink" -version = "0.0.1" +version = "0.1.5" dependencies = [ "anyhow", "arboard", diff --git a/Cargo.toml b/Cargo.toml index a53137d09e4..e7cddd4ebc6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,7 +22,7 @@ opt-level = 3 codegen-units = 1 [workspace.package] -version = "0.0.1" +version = "0.1.5" rust-version = "1.68" [workspace.dependencies] diff --git a/Makefile b/Makefile index e3e8864054e..00d04a58947 100644 --- a/Makefile +++ b/Makefile @@ -1,89 +1,87 @@ - -# the relevant documentation is provided by apple.developer.com, specifically regarding code signing and CFBundles. -# code signing resource guide: -# https://developer.apple.com/library/archive/documentation/Security/Conceptual/CodeSigningGuide/Procedures/Procedures.html - -# name of the executable TARGET = uplink -# stuff to copy over to RESOURCES_DIR -ASSETS_SOURCE_DIR = ui/extra - -# directory structure for .dmg : -# https://developer.apple.com/library/archive/documentation/CoreFoundation/Conceptual/CFBundles/BundleTypes/BundleTypes.html#//apple_ref/doc/uid/10000123i-CH101-SW8 +ASSETS_DIR = ./ui/extra +RELEASE_DIR = ./target/release -BUNDLE_DIR = target/macos_bundle -# folder used for the universal installer -DMG_NAME = $(BUNDLE_DIR)/Uplink.dmg -# folder used to build the .app -APP_DIR = $(BUNDLE_DIR)/Uplink.app +APP_NAME = Uplink.app +APP_TEMPLATE = $(ASSETS_DIR)/macos/$(APP_NAME) +APP_DIR = $(RELEASE_DIR)/macos +APP_BINARY = $(RELEASE_DIR)/$(TARGET) +CONTENTS = $(APP_DIR)/$(APP_NAME)/Contents +APP_BINARY_DIR = $(APP_DIR)/$(APP_NAME)/Contents/MacOS +APP_EXTRAS_DIR = $(APP_DIR)/$(APP_NAME)/Contents/Resources +APP_FRAMEWORKS_DIR = $(APP_DIR)/$(APP_NAME)/Contents/Frameworks -# contains all subfolders: MacOs, Resources, Frameworks -# https://developer.apple.com/library/archive/documentation/CoreFoundation/Conceptual/CFBundles/BundleTypes/BundleTypes.html#//apple_ref/doc/uid/20001119-110730 -APP_CONTENTS_DIR = $(APP_DIR)/Contents +DMG_NAME = Uplink.dmg +DMG_DIR = $(RELEASE_DIR)/macos -# contains standalone executables -MACOS_DIR = $(APP_CONTENTS_DIR)/MacOs -# contains resources -RESOURCES_DIR = $(APP_CONTENTS_DIR)/Resources -# contains shared libraries (.dylib) -FRAMEWORKS_DIR = $(APP_CONTENTS_DIR)/Frameworks +vpath $(TARGET) $(RELEASE_DIR) +vpath $(APP_NAME) $(APP_DIR) +vpath $(DMG_NAME) $(APP_DIR) all: help help: ## Print this help message @grep -E '^[a-zA-Z._-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' -folders: ## creates build directory and copies assets -# clean up from previous build - @rm -rf $(APP_DIR) - @rm -f $(DMG_NAME) - @mkdir -p $(APP_DIR) - -# this copy command also creates $(APP_CONTENTS_DIR) and $(RESOURCES_DIR) - @cp -fRp $(ASSETS_SOURCE_DIR)/macos/Uplink.App/Contents $(APP_DIR) - @mkdir $(MACOS_DIR) - @mkdir $(FRAMEWORKS_DIR) - - @cp -R $(ASSETS_SOURCE_DIR)/assets $(RESOURCES_DIR) - @cp -R $(ASSETS_SOURCE_DIR)/images $(RESOURCES_DIR) - @cp -R $(ASSETS_SOURCE_DIR)/prism_langs $(RESOURCES_DIR) - @cp -R $(ASSETS_SOURCE_DIR)/themes $(RESOURCES_DIR) - -app: folders ## Build the release binary and Uplink.app - @echo "make app ..." +binary: $(TARGET)-native ## Build a release binary +binary-universal: $(TARGET)-universal ## Build a universal release binary +$(TARGET)-native: + MACOSX_DEPLOYMENT_TARGET="10.11" cargo build --release -F production_mode + @lipo target/release/$(TARGET) -create -output $(APP_BINARY) +$(TARGET)-universal: MACOSX_DEPLOYMENT_TARGET="10.11" cargo build --release --target=x86_64-apple-darwin -F production_mode MACOSX_DEPLOYMENT_TARGET="10.11" cargo build --release --target=aarch64-apple-darwin -F production_mode - @lipo target/{x86_64,aarch64}-apple-darwin/release/$(TARGET) -create -output $(MACOS_DIR)/$(TARGET) - @lipo target/{x86_64,aarch64}-apple-darwin/release/libclear_all.dylib -create -output $(FRAMEWORKS_DIR)/libclear_all.dylib - @lipo target/{x86_64,aarch64}-apple-darwin/release/libemoji_selector.dylib -create -output $(FRAMEWORKS_DIR)/libemoji_selector.dylib - -# delete all special attributes. not sure why/if this is needed - xattr -c $(APP_CONTENTS_DIR)/Info.plist - xattr -c $(RESOURCES_DIR)/uplink.icns - -signed-app: app ## sign the executable, .dylibs, and Uplink.app directory - @echo "make signed-app ..." - /usr/bin/codesign -vvv --deep --entitlements $(ASSETS_SOURCE_DIR)/entitlements.plist --strict --options=runtime --force -s $(SIGNING_KEY) $(FRAMEWORKS_DIR)/libclear_all.dylib - /usr/bin/codesign -vvv --deep --entitlements $(ASSETS_SOURCE_DIR)/entitlements.plist --strict --options=runtime --force -s $(SIGNING_KEY) $(FRAMEWORKS_DIR)/libemoji_selector.dylib - /usr/bin/codesign -vvv --deep --entitlements $(ASSETS_SOURCE_DIR)/entitlements.plist --strict --options=runtime --force -s $(SIGNING_KEY) $(APP_DIR) - -unsigned-dmg: app ## build the universal Uplink.dmg file without signing + @lipo target/{x86_64,aarch64}-apple-darwin/release/$(TARGET) -create -output $(APP_BINARY) + @lipo target/{x86_64,aarch64}-apple-darwin/release/libemoji_selector.dylib -create -output $(RELEASE_DIR)/libemoji_selector.dylib + + /usr/bin/codesign -vvv --deep --entitlements $(ASSETS_DIR)/entitlements.plist --strict -s $(SIGNING_KEY) --options=runtime --force $(APP_BINARY) +# /usr/bin/codesign -vvv --deep --entitlements $(ASSETS_DIR)/entitlements.plist --strict -s $(SIGNING_KEY) --options=runtime --force $(APP_TEMPLATE) + +app: $(APP_NAME)-native ## Create a Uplink.app +app-universal: $(APP_NAME)-universal ## Create a universal Uplink.app +$(APP_NAME)-%: $(TARGET)-% + @mkdir -p $(APP_BINARY_DIR) + @mkdir -p $(APP_EXTRAS_DIR) + @mkdir -p $(APP_FRAMEWORKS_DIR) + @cp -fRp $(APP_TEMPLATE) $(APP_DIR) + @cp -fp $(APP_BINARY) $(APP_BINARY_DIR) + @touch -r "$(APP_BINARY)" "$(APP_DIR)/$(APP_NAME)" + @echo "Created '$(APP_NAME)' in '$(APP_DIR)'" + xattr -c $(APP_DIR)/$(APP_NAME)/Contents/Info.plist + xattr -c $(APP_DIR)/$(APP_NAME)/Contents/Resources/uplink.icns + + mkdir -p $(APP_DIR)/$(APP_NAME)/Contents/Resources/extra + cp -r ./ui/extra/* $(APP_DIR)/$(APP_NAME)/Contents/Resources +# cp -r ./ui/extra/images $(APP_DIR)/$(APP_NAME)/Contents/Resources/images +# cp -r ./ui/extra/prism_langs $(APP_DIR)/$(APP_NAME)/Contents/Resources/prism_langs +# cp -r ./ui/extra/themes $(APP_DIR)/$(APP_NAME)/Contents/Resources/themes + + cp $(RELEASE_DIR)/*.dylib $(APP_FRAMEWORKS_DIR) + /usr/bin/codesign -vvv --deep --entitlements $(ASSETS_DIR)/entitlements.plist --strict -s $(SIGNING_KEY) --options=runtime --force $(APP_FRAMEWORKS_DIR)/libemoji_selector.dylib + /usr/bin/codesign -vvv --deep --entitlements $(ASSETS_DIR)/entitlements.plist --strict --options=runtime --force -s $(SIGNING_KEY) $(APP_DIR)/$(APP_NAME) + +dmg: $(DMG_NAME)-native ## Create a Uplink.dmg +dmg-universal: $(DMG_NAME)-universal ## Create a universal Uplink.dmg +$(DMG_NAME)-%: $(APP_NAME)-% @echo "Packing disk image..." - @ln -sf /Applications $(BUNDLE_DIR)/Applications - @hdiutil create $(DMG_NAME) \ + @ln -sf /Applications $(DMG_DIR)/Applications + @hdiutil create $(DMG_DIR)/$(DMG_NAME) \ -volname "Uplink" \ -fs HFS+ \ - -srcfolder $(BUNDLE_DIR) \ + -srcfolder $(APP_DIR) \ -ov -format UDZO - @echo "Packed '$(BUNDLE_DIR)' into dmg" + @echo "Packed '$(APP_NAME)' in '$(APP_DIR)'" + /usr/bin/codesign -vvv --entitlements $(ASSETS_DIR)/entitlements.plist --strict --options=runtime --force -s $(SIGNING_KEY) $(DMG_DIR)/$(DMG_NAME) -dmg: signed-app unsigned-dmg ## sign Uplink.dmg - @echo "make dmg..." - /usr/bin/codesign -vvv --deep --entitlements $(ASSETS_SOURCE_DIR)/entitlements.plist --strict --options=runtime --force -s $(SIGNING_KEY) $(DMG_NAME) +install: $(INSTALL)-native ## Mount disk image +install-universal: $(INSTALL)-native ## Mount universal disk image +$(INSTALL)-%: $(DMG_NAME)-% + @open $(DMG_DIR)/$(DMG_NAME) + +.PHONY: app binary clean dmg install $(TARGET) $(TARGET)-universal -# tell Make that these targets don't correspond to physical files -.PHONY: dmg unsigned-dmg signed-app app folders help all clean clean: ## Remove all build artifacts @cargo clean - +watch: ## run this first: `cargo install cargo-watch` + @cargo watch -x 'run' \ No newline at end of file diff --git a/ui/deb/DEBIAN/control b/ui/deb/DEBIAN/control index e97891eba98..8ac79f3cdff 100755 --- a/ui/deb/DEBIAN/control +++ b/ui/deb/DEBIAN/control @@ -1,10 +1,10 @@ Package: {{package}} Version: {{version}} -Vendor: Satellite Im -Description: P2P chat application -Section: net +Vendor: Satellite IM Inc +Description: (Pre-Release Software) Secure, Encrypted, P2P chat written atop Warp, IPFS, LibP2P, and many more awesome projects and protocols. +Section: net, communication Priority: required -Depends: libwebkit2gtk-4.1-0 libopus0, ffmpeg -Maintainer: matt.wisniewski@deepspaceshipping.co +Depends: libwebkit2gtk-4.1-0, libopus0, ffmpeg +Maintainer: hello@satellite.im Architecture: {{architecture}} Homepage: https://satellite.im/ diff --git a/ui/wix/main.wxs b/ui/wix/main.wxs index ca86422963a..1c6357d9f22 100644 --- a/ui/wix/main.wxs +++ b/ui/wix/main.wxs @@ -173,9 +173,6 @@ - - - @@ -211,7 +208,6 @@ -