Skip to content

Commit

Permalink
Update automated build scripts (#52)
Browse files Browse the repository at this point in the history
* update: wip

* try win with updated tonlib

* add secp256k1 for win tonlib

* adjust Visual Studio for github runner

* add sodium to win build

* test tonlib testnet compilation

* test tonlib testnet compilation

* test tonlib testnet compilation

* back to newton-blockchain/ton:wallets branch

* back to newton-blockchain/ton:wallets branch

* back to newton-blockchain/ton:wallets branch

* back to newton-blockchain/ton:wallets branch

* adding macos runner; wip

* adding macos runner; wip

* adding macos runner; wip

* patch qtbase for macos 12

* Update wallet-desktop repo. Remove outdated macOS github action + escape s

* Update wallet-desktop repo. Remove outdated macOS github action + replace

* macos sed differences :/

* typo

* install python-setuptools for macos

* symlink to python

* symlink to python

* alias python=python3

* try macos 12.7.1

* back to macos 11.7 with patched gyp

* fix brew upgrade

* force python 2.7

* disable brew update (very slow on GH)

* target macos 10.11

* openssl arch typo

* use newer crashpad

* Revert "use newer crashpad"

This reverts commit be32aa5.

* rollback crashpad, use macos target 10.8

* disable warning errors for crashpad

* rename auto-build folder for macos

---------

Co-authored-by: neodiX <[email protected]>
  • Loading branch information
neodix42 and neodiX authored Apr 16, 2024
1 parent 44a0347 commit 27908c8
Show file tree
Hide file tree
Showing 9 changed files with 388 additions and 151 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/macos-wallet-compile.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: MacOS 11.7 TON Desktop wallet compile
on: [push,pull_request,workflow_dispatch]
jobs:
build:
runs-on: macos-11
steps:
- name: Check out current repository
uses: actions/checkout@v2
with:
path: wallet-desktop
- name: Compile macos desktop wallet
run: |
cd wallet-desktop/auto-build/macos-11.7
chmod +x compile.sh
./compile.sh
- name: Find & copy binaries
run: |
mkdir artifacts
chmod -R 777 wallet-desktop/auto-build/macos-11.7/wallet-desktop/out/Release/Wallet.app
cp -R wallet-desktop/auto-build/macos-11.7/wallet-desktop/out/Release/Wallet.app artifacts
- name: Upload artifacts
uses: actions/upload-artifact@master
with:
name: ton-macos-desktop-wallet
path: artifacts
4 changes: 3 additions & 1 deletion .github/workflows/ubuntu-20.04-wallet-compile.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: C/C++ CI Ubuntu 20.04 x86-64 TON Desktop wallet compile

on: [pull_request,workflow_dispatch]
on: [push,pull_request,workflow_dispatch]

jobs:
build:
Expand All @@ -11,6 +11,8 @@ jobs:
uses: actions/checkout@v2
with:
path: wallet-desktop
submodules: 'recursive'

- name: Compile linux desktop wallet
run: |
cd wallet-desktop/auto-build/ubuntu-20.04
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/windows-wallet-compile.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: C/C++ CI Windows TON Desktop wallet compile

on: [pull_request,workflow_dispatch]
on: [push,pull_request,workflow_dispatch]

defaults:
run:
Expand All @@ -15,6 +15,7 @@ jobs:
uses: actions/checkout@v2
with:
path: wallet-desktop
submodules: 'recursive'

- name: Setup msbuild.exe
uses: microsoft/[email protected]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,31 @@
#!/bin/bash

MAKE_THREADS_CNT=-j8
MACOSX_DEPLOYMENT_TARGET=10.12
MACOSX_DEPLOYMENT_TARGET=10.8

# echo | /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
brew install automake cmake fdk-aac git lame libass libtool libvorbis libvpx ninja opus sdl shtool texi2html theora wget x264 xvid yasm pkg-config python-setuptools


which python
which python3

#sudo mkdir -p /usr/local/bin
#export PATH=/usr/local/bin:$PATH
#echo "alias python=python3" >> ~/.zshrc
#source ~/.zshrc

brew install pyenv
echo | pyenv install 2.7.18
pyenv global 2.7.18
PATH=$(pyenv root)/shims:$PATH

which python
which python3
python -V

echo $PATH

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install automake cmake fdk-aac git lame libass libtool libvorbis libvpx ninja opus sdl shtool texi2html theora wget x264 xvid yasm pkg-config

sudo xcode-select -s /Applications/Xcode.app/Contents/Developer

Expand Down Expand Up @@ -32,7 +53,9 @@ export PATH="$PWD/depot_tools:$PATH"
cd gyp
git checkout 9f2a7bb1
git apply ../patches/gyp.diff
#sed -i -e 's/python/python3/g' setup.py
./setup.py build
test $? -eq 0 || { echo "Can't setup gyp"; exit 1; }
sudo ./setup.py install
cd ../..

Expand All @@ -51,23 +74,27 @@ cd ..
git clone --branch 0.10.0 https://github.com/ericniebler/range-v3

cd xz-5.0.5
CFLAGS="-mmacosx-version-min=10.12" LDFLAGS="-mmacosx-version-min=10.12" ./configure --prefix=/usr/local/macos
CFLAGS="-mmacosx-version-min=10.8" LDFLAGS="-mmacosx-version-min=10.8" ./configure --prefix=/usr/local/macos
make $MAKE_THREADS_CNT
test $? -eq 0 || { echo "Can't compile xz-5.0.5"; exit 1; }
sudo make install
cd ..

git clone https://github.com/desktop-app/zlib.git
cd zlib
CFLAGS="-mmacosx-version-min=10.12 -Werror=unguarded-availability-new" LDFLAGS="-mmacosx-version-min=10.12" ./configure --prefix=/usr/local/macos
CFLAGS="-mmacosx-version-min=10.8 -Werror=unguarded-availability-new" LDFLAGS="-mmacosx-version-min=10.8" ./configure --prefix=/usr/local/macos
make $MAKE_THREADS_CNT
test $? -eq 0 || { echo "Can't compile zlib"; exit 1; }
sudo make install
cd ..

git clone https://github.com/openssl/openssl openssl_1_1_1
cd openssl_1_1_1
git checkout OpenSSL_1_1_1-stable
./Configure --prefix=/usr/local/macos darwin64-x86_64-cc -static -mmacosx-version-min=10.12
./Configure --prefix=/usr/local/macos darwin64-x86_64-cc -static -mmacosx-version-min=10.8
test $? -eq 0 || { echo "Can't configure openssl_1_1_1"; exit 1; }
make build_libs $MAKE_THREADS_CNT
test $? -eq 0 || { echo "Can't compile openssl_1_1_1"; exit 1; }
cd ..


Expand All @@ -80,29 +107,43 @@ git clone https://chromium.googlesource.com/chromium/mini_chromium
cd mini_chromium
git checkout 7c5b0c1ab4
git apply ../../../../patches/mini_chromium.diff
test $? -eq 0 || { echo "Can't apply mini_chromium.diff"; exit 1; }
cd ../../gtest
git clone https://chromium.googlesource.com/external/github.com/google/googletest gtest
cd gtest
git checkout d62d6c6556
cd ../../..

git apply $rootPath/wallet-desktop/auto-build/macos-10.15/crashpad.patch
git apply $rootPath/wallet-desktop/auto-build/macos-11.7/crashpad.patch
test $? -eq 0 || { echo "Can't apply crashpad.patch"; exit 1; }

build/gyp_crashpad.py -Dmac_deployment_target=10.10
build/gyp_crashpad.py -Dmac_deployment_target=10.8
test $? -eq 0 || { echo "Can't prepare gyp_crashpad"; exit 1; }
find out/Debug -type f -name "*.ninja" -print0 | xargs -0 sed -i '' -e 's/-Werror//g'
ninja -C out/Debug
test $? -eq 0 || { echo "Can't configure debug gyp_crashpad"; exit 1; }
find out/Release -type f -name "*.ninja" -print0 | xargs -0 sed -i '' -e 's/-Werror//g'
ninja -C out/Release
test $? -eq 0 || { echo "Can't configure release gyp_crashpad"; exit 1; }

cd ..

git clone git://code.qt.io/qt/qt5.git qt5_12_8
cd qt5_12_8
perl init-repository --module-subset=qtbase,qtimageformats
git checkout v5.12.8
perl init-repository --module-subset=qtbase,qtimageformats
git submodule update qtbase
git submodule update qtimageformats
cd qtbase
git apply ../../patches/qtbase_5_12_8.diff
cat src/plugins/platforms/cocoa/qiosurfacegraphicsbuffer.h
sed -i -e 's@qcore_mac_p.h>@qcore_mac_p.h>\n#include <CoreGraphics/CGColorSpace.h>\n@g' src/plugins/platforms/cocoa/qiosurfacegraphicsbuffer.h
cat src/plugins/platforms/cocoa/qiosurfacegraphicsbuffer.h

cd ..



./configure -prefix "/usr/local/desktop-app/Qt-5.12.8" \
-debug-and-release \
-force-debug-info \
Expand All @@ -117,6 +158,7 @@ cd ..
-platform macx-clang

make $MAKE_THREADS_CNT
test $? -eq 0 || { echo "Can't compile qt5_12_8"; exit 1; }
sudo make install
cd ..

Expand All @@ -128,19 +170,24 @@ git submodule init
git submodule update third-party/crc32c
mkdir build-debug
cd build-debug
cmake -DTON_USE_ROCKSDB=OFF -DTON_USE_ABSEIL=OFF -DTON_ARCH= -DTON_ONLY_TONLIB=ON -DOPENSSL_FOUND=1 -DOPENSSL_INCLUDE_DIR=$LibrariesPath/openssl_1_1_1/include -DOPENSSL_CRYPTO_LIBRARY=$LibrariesPath/openssl_1_1_1/libcrypto.a -DZLIB_FOUND=1 -DZLIB_INCLUDE_DIR=$LibrariesPath/zlib -DZLIB_LIBRARY=/usr/local/macos/lib/libz.a -DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.12 -DCMAKE_CXX_FLAGS="-stdlib=libc++" ..
cmake -DTON_USE_ROCKSDB=OFF -DTON_USE_ABSEIL=OFF -DTON_ARCH= -DTON_ONLY_TONLIB=ON -DOPENSSL_FOUND=1 -DOPENSSL_INCLUDE_DIR=$LibrariesPath/openssl_1_1_1/include -DOPENSSL_CRYPTO_LIBRARY=$LibrariesPath/openssl_1_1_1/libcrypto.a -DZLIB_FOUND=1 -DZLIB_INCLUDE_DIR=$LibrariesPath/zlib -DZLIB_LIBRARY=/usr/local/macos/lib/libz.a -DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8 -DCMAKE_CXX_FLAGS="-stdlib=libc++" ..
test $? -eq 0 || { echo "Can't configure debug ton"; exit 1; }
make $MAKE_THREADS_CNT tonlib
test $? -eq 0 || { echo "Can't compile debug ton"; exit 1; }
cd ..
mkdir build
cd build
cmake -DTON_USE_ROCKSDB=OFF -DTON_USE_ABSEIL=OFF -DTON_ARCH= -DTON_ONLY_TONLIB=ON -DOPENSSL_FOUND=1 -DOPENSSL_INCLUDE_DIR=$LibrariesPath/openssl_1_1_1/include -DOPENSSL_CRYPTO_LIBRARY=$LibrariesPath/openssl_1_1_1/libcrypto.a -DZLIB_FOUND=1 -DZLIB_INCLUDE_DIR=$LibrariesPath/zlib -DZLIB_LIBRARY=/usr/local/macos/lib/libz.a -DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.12 -DCMAKE_CXX_FLAGS="-stdlib=libc++" -DCMAKE_BUILD_TYPE=Release ..
cmake -DTON_USE_ROCKSDB=OFF -DTON_USE_ABSEIL=OFF -DTON_ARCH= -DTON_ONLY_TONLIB=ON -DOPENSSL_FOUND=1 -DOPENSSL_INCLUDE_DIR=$LibrariesPath/openssl_1_1_1/include -DOPENSSL_CRYPTO_LIBRARY=$LibrariesPath/openssl_1_1_1/libcrypto.a -DZLIB_FOUND=1 -DZLIB_INCLUDE_DIR=$LibrariesPath/zlib -DZLIB_LIBRARY=/usr/local/macos/lib/libz.a -DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8 -DCMAKE_CXX_FLAGS="-stdlib=libc++" -DCMAKE_BUILD_TYPE=Release ..
test $? -eq 0 || { echo "Can't configure release ton"; exit 1; }
make $MAKE_THREADS_CNT tonlib
test $? -eq 0 || { echo "Can't compile release ton"; exit 1; }

cd $rootPath/wallet-desktop/Wallet/
./configure.sh -D DESKTOP_APP_USE_PACKAGED=OFF
test $? -eq 0 || { echo "Can't configure wallet"; exit 1; }

git apply $rootPath/wallet-desktop/auto-build/macos-10.15/wallet.patch

git apply $rootPath/wallet-desktop/auto-build/macos-11.7/wallet.patch
test $? -eq 0 || { echo "Can't apply wallet.patch"; exit 1; }
cd ../out

xcodebuild -list -project Wallet.xcodeproj
Expand Down
File renamed without changes.
File renamed without changes.
34 changes: 23 additions & 11 deletions auto-build/ubuntu-20.04/build-wallet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function grn() { echo -e -n "\033[1;32m$1\033[0m\n"; }
function blu() { echo -e -n "\033[1;34m$1\033[0m\n"; }

if [ ! -f "system-deps-installed" ]; then
yel "Installing neccessary system dependencies"
yel "Installing necessary system dependencies"
apt update && apt install git && \
apt install python2.7 python2.7-minimal libpython2.7-minimal libpython2.7-stdlib -y && \
update-alternatives --install /usr/bin/python python /usr/bin/python2.7 10 && \
Expand All @@ -31,7 +31,7 @@ if [ ! -f "system-deps-installed" ]; then
libxcb-render-util0-dev libxcb-util0-dev libxcb-xkb-dev libxrender-dev \
libasound-dev libpulse-dev libxcb-sync0-dev libxcb-randr0-dev libegl1-mesa-dev \
libx11-xcb-dev libffi-dev libncurses5-dev pkg-config texi2html bison yasm \
zlib1g-dev xutils-dev chrpath gperf -y && \
zlib1g-dev xutils-dev chrpath gperf libsodium-dev liblz4-dev libsecp256k1-dev -y && \
add-apt-repository ppa:ubuntu-toolchain-r/test -y && \
apt-get update && \
apt-get install gcc-8 g++-8 -y && \
Expand All @@ -49,10 +49,11 @@ if [ ! -f "system-deps-installed" ]; then
fi

if [ ! -d 'wallet-desktop' ]; then
yel "Cloning $WALLET_REPO_ACCOUNT/wallet-desktop:$WALLET_BRANCH"
git clone -b "$WALLET_BRANCH" --recursive "https://github.com/$WALLET_REPO_ACCOUNT/wallet-desktop.git"
mkdir wallet-desktop
cd wallet-desktop || exit
git submodule update --remote Wallet/lib_wallet
cp -R ../../../Wallet .
cp -R ../../../cmake .
cp -R ../../../CMakeLists.txt .
cd .. # wallet-desktop
grn "wallet-desktop completed"
else
Expand All @@ -66,7 +67,7 @@ if [ ! -d 'cmake' ]; then
yel "Cloning and building cmake"
git clone https://github.com/Kitware/CMake cmake
cd cmake || exit
git checkout v3.16.0
git checkout v3.21.0
./bootstrap
make $MAKE_THREADS_CNT
make install
Expand Down Expand Up @@ -102,6 +103,7 @@ if [ ! -d 'openssl_1_1_1' ]; then
git checkout OpenSSL_1_1_1-stable
./config --prefix=/usr/local/desktop-app/openssl-1.1.1
make $MAKE_THREADS_CNT
test $? -eq 0 || { red "Can't compile openssl-1.1.1"; exit 1; }
make install
cd .. # openssl_1_1_1
grn "openssl completed"
Expand All @@ -116,6 +118,7 @@ if [ ! -d 'libxkbcommon' ]; then
git checkout xkbcommon-0.8.4
./autogen.sh --disable-x11
make $MAKE_THREADS_CNT
test $? -eq 0 || { red "Can't compile libxkbcommon"; exit 1; }
make install
cd .. # libxkbcommon
grn "libxkbcommon completed"
Expand All @@ -131,6 +134,7 @@ if [ ! -d 'googletest' ]; then
cd build || exit
cmake ..
make
test $? -eq 0 || { red "Can't compile googletest"; exit 1; }
cp lib/*.a /usr/lib
cd .. # build
cd .. # googletest
Expand All @@ -143,8 +147,8 @@ if [ ! -d 'qt_5_12_8' ]; then
yel "Cloning and building qt 5.12.8"
git clone git://code.qt.io/qt/qt5.git qt_5_12_8
cd qt_5_12_8 || exit
perl init-repository --module-subset=qtbase,qtwayland,qtimageformats,qtsvg
git checkout v5.12.8
perl init-repository --module-subset=qtbase,qtwayland,qtimageformats,qtsvg
git submodule update qtbase
git submodule update qtwayland
git submodule update qtimageformats
Expand All @@ -168,6 +172,7 @@ if [ ! -d 'qt_5_12_8' ]; then
-nomake examples -nomake tests

make $MAKE_THREADS_CNT
test $? -eq 0 || { red "Can't compile QT"; exit 1; }
make install
cd .. # qt_5_12_8
grn "qt completed"
Expand Down Expand Up @@ -207,13 +212,15 @@ if [ ! -d 'breakpad' ]; then
sed -i 's/static int tgkill/int tgkill/g' src/client/linux/handler/exception_handler.cc

make $MAKE_THREADS_CNT
test $? -eq 0 || { red "Can't compile breakpad"; exit 1; }
make install
cd src/tools || exit
../../../gyp/gyp --depth=. --generator-output=.. -Goutput_dir=../out tools.gyp --format=cmake
cd ../.. # src/tools
cd out/Default || exit
cmake .
make $MAKE_THREADS_CNT dump_syms
test $? -eq 0 || { red "Can't compile dump_syms"; exit 1; }
cd ../.. # out/Default
cd .. # breakpad
grn "breakpad completed"
Expand All @@ -223,23 +230,24 @@ fi

if [ ! -d 'ton' ]; then
yel "Cloning and building $TONLIB_REPO_ACCOUNT/ton:$TONLIB_BRANCH"
git clone --single-branch --branch "$TONLIB_BRANCH" "https://github.com/$TONLIB_REPO_ACCOUNT/ton.git"
git clone --recursive "https://github.com/$TONLIB_REPO_ACCOUNT/ton.git"
cd ton || exit
git submodule init
git submodule update third-party/crc32c
git checkout $TONLIB_BRANCH
mkdir build-debug
mkdir build
cd build-debug || exit
cmake -DTON_USE_ROCKSDB=OFF -DTON_USE_ABSEIL=OFF -DTON_ONLY_TONLIB=ON \
-DOPENSSL_FOUND=1 -DOPENSSL_INCLUDE_DIR=/usr/local/desktop-app/openssl-1.1.1/include \
-DOPENSSL_CRYPTO_LIBRARY=/usr/local/desktop-app/openssl-1.1.1/lib/libcrypto.a \
-DTON_ARCH="$(uname -m | sed --expression='s/_/-/g')" ..
test $? -eq 0 || { red "Can't configure debug tonlib"; exit 1; }
cd .. # build-debug
cd build || exit
cmake -DTON_USE_ROCKSDB=OFF -DTON_USE_ABSEIL=OFF -DTON_ONLY_TONLIB=ON \
-DOPENSSL_FOUND=1 -DOPENSSL_INCLUDE_DIR=/usr/local/desktop-app/openssl-1.1.1/include \
-DOPENSSL_CRYPTO_LIBRARY=/usr/local/desktop-app/openssl-1.1.1/lib/libcrypto.a \
-DTON_ARCH="$(uname -m | sed --expression='s/_/-/g')" -DCMAKE_BUILD_TYPE=Release ..
test $? -eq 0 || { red "Can't configure release tonlib"; exit 1; }
cd .. # build
cd .. # ton
grn "ton (tonlib) completed"
Expand All @@ -250,6 +258,7 @@ fi
cd ton/build || exit
yel "Building tonlib"
make $MAKE_THREADS_CNT tonlib
test $? -eq 0 || { red "Can't build tonlib"; exit 1; }
grn "tonlib build completed"
cd ../.. # ton/build

Expand All @@ -274,12 +283,14 @@ cd wallet-desktop || exit
cd Wallet || exit
yel "Configuring Wallet"
./configure.sh -D DESKTOP_APP_USE_PACKAGED=OFF
grn "Confugration done"
test $? -eq 0 || { red "Can't configure Wallet"; exit 1; }
grn "Configuration done"
cd ..

cd out/Release || exit
yel "Building Wallet (Release)"
make $MAKE_THREADS_CNT
test $? -eq 0 || { red "Can't build Wallet"; exit 1; }
grn "Build done"
cd ../.. # out/Release

Expand All @@ -288,4 +299,5 @@ cd .. # wallet-desktop
blu "Stripping symbols"
cp wallet-desktop/out/Release/bin/Wallet ./
strip ./Wallet
test $? -eq 0 || { red "Can't strip Wallet"; exit 1; }
grn "All done!"
Loading

0 comments on commit 27908c8

Please sign in to comment.