Build improvements (#116)

* Add custom brew libusb formula

* start using our brew tap instead of mannual building qt and libusb

* fix build_mac.sh

* Debug

* debug off

* try older linuxdeploy version

* creating dmg by other way

* removing create-dmg, update README.md

* debug linuxdeploy

* try new-linked linuxdeploy

* disable debug

* try to install boost

* fix Dockerfile

* disable all debugs

* temp disable layer chaching

* Fixing and self-hosting linuxdeploy

* restoring docker cache, fix linux_deploy.sh shellcheck warnings

* fix typo in build_linux.sh

* Rename misc directory
This commit is contained in:
Max Andreev 2022-09-29 19:50:16 +05:00 committed by GitHub
parent fe09e5aca0
commit 474811477f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 56 additions and 92 deletions

View File

@ -20,6 +20,7 @@ jobs:
with:
key: docker-cache-${{ hashFiles('docker/**') }}-{hash}
restore-keys: docker-cache-${{ hashFiles('docker/**') }}-
- name: Build docker image
uses: ./.github/actions/docker

3
.gitmodules vendored
View File

@ -4,6 +4,3 @@
[submodule "3rdparty/nanopb"]
path = 3rdparty/nanopb
url = https://github.com/nanopb/nanopb.git
[submodule "scripts/create-dmg"]
path = scripts/create-dmg
url = https://github.com/flipperdevices/create-dmg

View File

@ -65,8 +65,9 @@ In this case, it is possible to disable the built-in application update feature
Build requirements:
- Xcode or command line tools
- Qt5 >= 5.15.0 or Qt6 >= 6.3.0
- libusb
- Qt6 6.3.1 static universal from [Flipper brew tap](https://github.com/flipperdevices/homebrew-flipper)
- libusb 1.0.24 universal from [Flipper brew tap](https://github.com/flipperdevices/homebrew-flipper)
- [dmgbuild](https://pypi.org/project/dmgbuild/) >= 1.5.2
If you want to sign binaries, set `SIGNING_KEY` environment variable:

View File

@ -1,15 +1,19 @@
#!/bin/bash
set -ex
set -euxo pipefail;
TARGET='qFlipper'
BUILDDIR='build'
TARGET="qFlipper"
BUILDDIR="build"
APPDIR_PREFIX="$PWD/$BUILDDIR/AppDir/usr"
LIBSSL1_OVERRIDE="$(ldconfig -p | grep x86-64 | grep -oP '/[^\s]+/libssl.so.1.1' | head -n1)"
export OUTPUT=$TARGET-x86_64.AppImage
export QML_SOURCES_PATHS='..'
export OUTPUT="$TARGET-x86_64.AppImage"
export QML_SOURCES_PATHS=".."
mkdir -p $BUILDDIR && cd $BUILDDIR
qmake ../$TARGET.pro -spec linux-g++ CONFIG+=qtquickcompiler PREFIX=$APPDIR_PREFIX && make qmake_all && make -j$(nproc) && make install
linuxdeploy --appdir=AppDir -o appimage --custom-apprun=../installer-assets/appimage/AppRun --plugin=qt --library=$LIBSSL1_OVERRIDE
mkdir -p "$BUILDDIR"
cd "$BUILDDIR"
qmake "../$TARGET.pro" -spec linux-g++ CONFIG+=qtquickcompiler PREFIX="$APPDIR_PREFIX"
make qmake_all
make -j"$(nproc)"
make install
linuxdeploy --appdir=AppDir -o appimage --custom-apprun="../installer-assets/appimage/AppRun" --plugin=qt --library="$LIBSSL1_OVERRIDE"

View File

@ -6,7 +6,6 @@ set -exuo pipefail;
PROJECT="qFlipper";
BUILD_DIRECTORY="build_mac";
LIBUSB_PATH="/opt/libs/libusb/1.0.24-universal";
if [ -d ".git" ]; then
git submodule update --init;
@ -19,12 +18,27 @@ fi
if [[ "$(uname -m)" == "arm64" ]]; then
eval "$(/opt/homebrew/bin/brew shellenv)";
PATH="/opt/homebrew/qt-6.3.1-static/bin:$PATH";
export PKG_CONFIG_PATH="$LIBUSB_PATH/lib/pkgconfig";
else
eval "$(/usr/local/Homebrew/bin/brew shellenv)";
fi
if ! brew --version; then
echo "Brew isn't installed!";
exit 1;
fi
if ! brew --prefix libusb_universal; then
echo "Please install libusb_universal first!";
printf "\tbrew install flipperdevices/homebrew-flipper/libusb_universal\n";
exit 1;
fi
if ! brew --prefix qt_universal; then
echo "Please install qt_universal first!";
printf "\tbrew install flipperdevices/homebrew-flipper/qt_universal\n";
exit 1;
fi
rm -rf "$BUILD_DIRECTORY";
mkdir "$BUILD_DIRECTORY";
@ -43,7 +57,7 @@ make install;
# bundle libusb
mkdir -p "$PROJECT.app/Contents/Frameworks";
cp "$LIBUSB_PATH/lib/libusb-1.0.0.dylib" "$PROJECT.app/Contents/Frameworks";
cp "$(brew --prefix libusb_universal)/lib/libusb-1.0.0.dylib" "$PROJECT.app/Contents/Frameworks";
relink_framework()
{
@ -89,14 +103,8 @@ if [ -n "${MAC_OS_SIGNING_KEY_ID:-""}" ]; then
fi
# build DMG
mkdir disk_image;
mv "$PROJECT.app" "disk_image/";
cp "../installer-assets/macos/DS_Store" "disk_image/.DS_Store";
cp -r "../installer-assets/macos/background" "disk_image/.background";
../scripts/create-dmg/create-dmg \
--volname "$PROJECT-$(git describe --tags --abbrev=0)" \
--volicon "../installer-assets/icons/${PROJECT}-installer.icns" \
--skip-jenkins \
--app-drop-link 485 150 \
"$PROJECT.dmg" \
"disk_image/";
dmgbuild \
-s "../installer-assets/macos/dmgbuild-config.py" \
-D "app=$PROJECT.app" \
"$PROJECT-$(git describe --tags --abbrev=0)" \
"$PROJECT.dmg";

View File

@ -31,10 +31,10 @@ RUN add-apt-repository ppa:beineri/opt-qt-5.15.2-bionic && \
qt515wayland \
&& apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
RUN wget https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage -O /usr/bin/linuxdeploy \
RUN wget https://update.flipperzero.one/builds/misc/linuxdeploy-x86_64-29092022.AppImage -O /usr/bin/linuxdeploy \
&& chmod +x /usr/bin/linuxdeploy
RUN wget https://github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/download/continuous/linuxdeploy-plugin-qt-x86_64.AppImage -O /usr/bin/linuxdeploy-plugin-qt \
RUN wget https://update.flipperzero.one/builds/misc/linuxdeploy-plugin-qt-x86_64-29092022.AppImage -O /usr/bin/linuxdeploy-plugin-qt \
&& chmod +x /usr/bin/linuxdeploy-plugin-qt
RUN git config --global --replace-all safe.directory '*'

Binary file not shown.

View File

@ -0,0 +1,15 @@
import os.path
application = defines.get('app', False)
appname = os.path.basename(application)
format = 'UDZO'
files = [application]
symlinks = {'Applications': '/Applications'}
hide_extension = [application]
icon = '../installer-assets/macos/VolumeIcon.icns'
background = '../installer-assets/macos/background/qFlipper_disk_background.png'
icon_locations = {
appname: (125, 150),
'Applications': (485, 150)
}
window_rect = ((200, 120), (600, 400))

View File

@ -1,30 +0,0 @@
#!/bin/bash
TMP_DIR="/tmp/$(openssl rand -hex 3)";
LIBUSB_PATH="/opt/libs/libusb/1.0.24-universal";
build()
{
local ARCH="$1";
make clean;
rm -rf "$TMP_DIR/libusb-$ARCH";
rm -f Makefile;
arch -"$ARCH" ./configure --prefix=/Users/build/temp/libusb-"$ARCH" CFLAGS="-mmacosx-version-min=10.14";
arch -"$ARCH" make;
arch -"$ARCH" make install;
}
join()
{
lipo \
-create \
-output \
"$LIBUSB_PATH/lib/libusb-1.0.0.dylib" \
"$TMP_DIR/libusb-x86_64/lib/libusb-1.0.0.dylib" \
"$TMP_DIR/libusb-arm64/lib/libusb-1.0.0.dylib";
}
build "x86_64";
build "arm64";
join;
rm -rf "$TMP_DIR";

View File

@ -1,31 +0,0 @@
#!/bin/bash
QT_VERSION="6.3.1";
QT_URL="https://download.qt.io/official_releases/qt/6.3/$QT_VERSION/single/qt-everywhere-src-$QT_VERSION.tar.xz"
QT_INSTALL_DIR="/opt/homebrew/qt-6.3.1-static"
rm -rf "qt-everywhere-src-$QT_VERSION";
wget "$QT_URL";
tar -xvf "qt-everywhere-src-$QT_VERSION.tar.zx";
cd "qt-everywhere-src-$QT_VERSION";
mkdir "build";
cd "build";
/opt/homebrew/Cellar/cmake/3.24.1/bin/cmake \
'-DBUILD_qtwebengine=OFF' \
'-DBUILD_SHARED_LIBS=OFF' \
'-DCMAKE_INSTALL_PREFIX=/opt/homebrew/qt-6.3.1-static' \
'-DQT_BUILD_TESTS=FALSE' \
'-DQT_BUILD_EXAMPLES=FALSE' \
'-DCMAKE_BUILD_TYPE=Release' \
'-DCMAKE_OSX_ARCHITECTURES=x86_64;arm64;' \
'-DQT_BUILD_TESTS_BY_DEFAULT=OFF' \
'-DINPUT_sql_mysql=no' \
'-DINPUT_sql_odbc=no' \
'-DINPUT_sql_psql=no' \
'-DINPUT_system_sqlite=no' \
'-G' 'Ninja' \
'/Users/build/qt-everywhere-src-6.3.1'
/opt/homebrew/Cellar/cmake/3.24.1/bin/cmake --build . --parallel
/opt/homebrew/Cellar/cmake/3.24.1/bin/cmake --install .

@ -1 +0,0 @@
Subproject commit 11cff56757861851cdbec5c20c9493fc6f87a32f