From 659b8d5bf142a5e5d075516c9e3a969336b75f28 Mon Sep 17 00:00:00 2001 From: Dan Ballard Date: Thu, 4 Nov 2021 18:10:47 -0700 Subject: [PATCH] macos drone build --- .drone.yml | 84 +++++++++++++++++++++++++++++++++++++- LIBCWTCH-GO-MACOS.version | 1 + README.md | 7 +++- fetch-libcwtch-go-macos.sh | 6 +++ fetch-libcwtch-go.sh | 2 - fetch-tor-macos.sh | 7 ++++ macos/package-release.sh | 3 +- pubspec.yaml | 2 +- 8 files changed, 105 insertions(+), 7 deletions(-) create mode 100644 LIBCWTCH-GO-MACOS.version create mode 100755 fetch-libcwtch-go-macos.sh create mode 100755 fetch-tor-macos.sh diff --git a/.drone.yml b/.drone.yml index e8dd2ffd..0f9b5ce7 100644 --- a/.drone.yml +++ b/.drone.yml @@ -125,7 +125,6 @@ steps: - find . -type f -exec sha256sum {} \; > ./../sha256s.txt - mv ./../sha256s.txt . - cd .. - # TODO: do deployment once files actaully compile - scp -r -o StrictHostKeyChecking=no -i ~/id_rsa $DIR buildfiles@build.openprivacy.ca:/home/buildfiles/buildfiles/ - name: notify-email @@ -276,3 +275,86 @@ trigger: event: - push - pull_request + +--- +kind: pipeline +type: exec +name: macos + +platform: + os: darwin + arch: amd64 + +clone: + disable: true + +steps: + - name: clone + environment: + buildbot_key_b64: + from_secret: buildbot_key_b64 + commands: + - mkdir ~/.ssh + - echo $buildbot_key_b64 > ~/.ssh/id_rsa.b64 + - base64 -d ~/.ssh/id_rsa.b64 > ~/.ssh/id_rsa + - chmod 400 ~/.ssh/id_rsa + # force by pass of ssh host key check, less secure + - ssh-keyscan -H git.openprivacy.ca >> ~/.ssh/known_hosts + - git init + - git config core.sshCommand 'ssh -o StrictHostKeyChecking=no -i ~/.ssh/id_rsa' + - git remote add origin gogs@git.openprivacy.ca:$DRONE_REPO.git + - git pull origin trunk + - git fetch --tags + - git checkout $DRONE_COMMIT + # use Drone ssh var instead of hardcode to allow forks to build (gogs@git.openprivacy.ca:cwtch.im/cwtch-ui.git) + #- git clone gogs@git.openprivacy.ca:$DRONE_REPO.git . + #- git checkout $DRONE_COMMIT + + - name: fetch + commands: + - ./fetch-tor-macos.sh + - echo `git describe --tags --abbrev=1` > VERSION + - echo `date +%G-%m-%d-%H-%M` > BUILDDATE + - export PATH=$PATH:/Users/Dan/development/flutter/bin + - flutter pub get + - mkdir deploy + - ./fetch-libcwtch-go-macos.sh + - gem install --user-install cocoapods + + - name: build-macos + commands: + - export PATH=$PATH:/Users/Dan/development/flutter/bin + - export GEM_HOME=$HOME/.gem + - export PATH=$GEM_HOME/ruby/2.6.0/bin:$PATH + - flutter config --enable-macos-desktop + - flutter build macos --dart-define BUILD_VER=`cat VERSION` --dart-define BUILD_DATE=`cat BUILDDATE` + - export PATH=$PATH:/usr/local/bin #create-dmg + - macos/package-release.sh + - mkdir -p deploy + - mv Cwtch.dmg deploy + + - name: deploy-buildfiles + environment: + BUILDFILES_KEY: + from_secret: buildfiles_key + when: + event: push + status: [ success ] + commands: + - echo $BUILDFILES_KEY > ~/id_rsab64 + - base64 -d ~/id_rsab64 > ~/id_rsa + - chmod 400 ~/id_rsa + - export DIR=flwtch-macos-`cat VERSION`-`cat BUILDDATE` + - mv deploy $DIR + - cd $DIR + - find . -type f -exec shasum -a 512 {} \; > ./../sha512s.txt + - mv ./../sha512s.txt . + - cd .. + - scp -r -o StrictHostKeyChecking=no -i ~/id_rsa $DIR buildfiles@build.openprivacy.ca:/home/buildfiles/buildfiles/ + +trigger: + #repo: cwtch.im/cwtch-ui # allow forks to build? + branch: trunk + event: + - push + - pull_request \ No newline at end of file diff --git a/LIBCWTCH-GO-MACOS.version b/LIBCWTCH-GO-MACOS.version new file mode 100644 index 00000000..14a54896 --- /dev/null +++ b/LIBCWTCH-GO-MACOS.version @@ -0,0 +1 @@ +2021-11-04-19-59-v1.3.1-35-g81705ce \ No newline at end of file diff --git a/README.md b/README.md index da93bdd1..29280794 100644 --- a/README.md +++ b/README.md @@ -44,6 +44,7 @@ To build a release version and load normal profiles, use `build-release.sh X` in - run `flutter config --enable-linux-desktop` if you've never done so before - optional: launch cwtch-ui directly by running `flutter run -d linux` - to build cwtch-ui, run `flutter build linux` +- optional: launch cwtch-ui build with `env LD_LIBRARY_PATH=linux ./build/linux/x64/release/bundle/cwtch` - to package the build, run `linux/package-release.sh` ### Building on Windows (for Windows) @@ -60,9 +61,11 @@ To build a release version and load normal profiles, use `build-release.sh X` in ### Building on MacOS -- Navigate to https://git.openprivacy.ca/cwtch.im/libcwtch-go/releases and download the latest libCwtch.dylib into this folder -- Download and install Tor Browser (it's currently the only way to get tor for macos) +- Cocaopods is required, you may need to `gem install cocaopods -v 1.9.3` +- copy `libCwtch.dylib` into the root folder, or run `fetch-libcwtch-go-macos.sh` to download it +- run `fetch-tor-macos.sh` to fetch Tor or Download and install Tor Browser and `cp -r /Applications/Tor\ Browser.app/Contents/MacOS/Tor ./macos/` - `flutter build macos` +- optional: launch cwtch-ui build with `./build/linux/x64/release/bundle/cwtch` - `./macos/package-release.sh` results in a Cwtch.dmg that has libCwtch.dylib and tor in it as well and can be installed into Applications diff --git a/fetch-libcwtch-go-macos.sh b/fetch-libcwtch-go-macos.sh new file mode 100755 index 00000000..8fc870a1 --- /dev/null +++ b/fetch-libcwtch-go-macos.sh @@ -0,0 +1,6 @@ +#!/bin/sh + +VERSION=`cat LIBCWTCH-GO-MACOS.version` +echo $VERSION + +curl https://build.openprivacy.ca/files/libCwtch-go-macos-$VERSION/libCwtch.dylib --output libCwtch.dylib diff --git a/fetch-libcwtch-go.sh b/fetch-libcwtch-go.sh index 364e9ec3..fe331d0b 100755 --- a/fetch-libcwtch-go.sh +++ b/fetch-libcwtch-go.sh @@ -5,5 +5,3 @@ echo $VERSION wget https://build.openprivacy.ca/files/libCwtch-go-$VERSION/cwtch.aar -O android/cwtch/cwtch.aar wget https://build.openprivacy.ca/files/libCwtch-go-$VERSION/libCwtch.so -O linux/libCwtch.so - -# wget https://build.openprivacy.ca/files/libCwtch-go-$VERSION/libCwtch.dll -O windows/libCwtch.dll diff --git a/fetch-tor-macos.sh b/fetch-tor-macos.sh new file mode 100755 index 00000000..0d3e2ac7 --- /dev/null +++ b/fetch-tor-macos.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +cd macos +curl https://git.openprivacy.ca/openprivacy/buildfiles/raw/branch/master/tor/tor-macos-0.4.6.7.tar.gz --output tor.tar.gz +tar -xzf tor.tar.gz +chmod a+x Tor/tor.real +cd .. diff --git a/macos/package-release.sh b/macos/package-release.sh index 2fb65cf1..e3c09936 100755 --- a/macos/package-release.sh +++ b/macos/package-release.sh @@ -3,13 +3,14 @@ # Run from SRCROOT cp libCwtch.dylib build/macos/Build/Products/Release/Cwtch.app/Contents/Frameworks/ -cp -r /Applications/Tor\ Browser.app/Contents/MacOS/Tor build/macos/Build/Products/Release/Cwtch.app/Contents/MacOS/ +cp -r macos/Tor build/macos/Build/Products/Release/Cwtch.app/Contents/MacOS/ rm Cwtch.dmg rm -r macos_dmg mkdir macos_dmg cp -r "build/macos/Build/Products/Release/Cwtch.app" macos_dmg/ +# https://github.com/create-dmg/create-dmg create-dmg \ --volname "Cwtch" \ --volicon "macos/cwtch.icns" \ diff --git a/pubspec.yaml b/pubspec.yaml index 366d60a6..533b66f5 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -15,7 +15,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. # Read more about iOS versioning at # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html -version: 1.3.0+21 +version: 1.4.0+22 environment: sdk: ">=2.12.0 <3.0.0"