Skip to content

Commit 4748114

Browse files
authored
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
1 parent fe09e5a commit 4748114

File tree

11 files changed

+56
-92
lines changed

11 files changed

+56
-92
lines changed

.github/workflows/ci.yml

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ jobs:
2020
with:
2121
key: docker-cache-${{ hashFiles('docker/**') }}-{hash}
2222
restore-keys: docker-cache-${{ hashFiles('docker/**') }}-
23+
2324
- name: Build docker image
2425
uses: ./.github/actions/docker
2526

.gitmodules

-3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,3 @@
44
[submodule "3rdparty/nanopb"]
55
path = 3rdparty/nanopb
66
url = https://github.com/nanopb/nanopb.git
7-
[submodule "scripts/create-dmg"]
8-
path = scripts/create-dmg
9-
url = https://github.com/flipperdevices/create-dmg

README.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,9 @@ In this case, it is possible to disable the built-in application update feature
6565
Build requirements:
6666

6767
- Xcode or command line tools
68-
- Qt5 >= 5.15.0 or Qt6 >= 6.3.0
69-
- libusb
68+
- Qt6 6.3.1 static universal from [Flipper brew tap](https://github.com/flipperdevices/homebrew-flipper)
69+
- libusb 1.0.24 universal from [Flipper brew tap](https://github.com/flipperdevices/homebrew-flipper)
70+
- [dmgbuild](https://pypi.org/project/dmgbuild/) >= 1.5.2
7071

7172
If you want to sign binaries, set `SIGNING_KEY` environment variable:
7273

build_linux.sh

+12-8
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
11
#!/bin/bash
22

3-
set -ex
3+
set -euxo pipefail;
44

5-
TARGET='qFlipper'
6-
BUILDDIR='build'
5+
TARGET="qFlipper"
6+
BUILDDIR="build"
77
APPDIR_PREFIX="$PWD/$BUILDDIR/AppDir/usr"
88
LIBSSL1_OVERRIDE="$(ldconfig -p | grep x86-64 | grep -oP '/[^\s]+/libssl.so.1.1' | head -n1)"
99

10-
export OUTPUT=$TARGET-x86_64.AppImage
11-
export QML_SOURCES_PATHS='..'
10+
export OUTPUT="$TARGET-x86_64.AppImage"
11+
export QML_SOURCES_PATHS=".."
1212

13-
mkdir -p $BUILDDIR && cd $BUILDDIR
14-
qmake ../$TARGET.pro -spec linux-g++ CONFIG+=qtquickcompiler PREFIX=$APPDIR_PREFIX && make qmake_all && make -j$(nproc) && make install
15-
linuxdeploy --appdir=AppDir -o appimage --custom-apprun=../installer-assets/appimage/AppRun --plugin=qt --library=$LIBSSL1_OVERRIDE
13+
mkdir -p "$BUILDDIR"
14+
cd "$BUILDDIR"
15+
qmake "../$TARGET.pro" -spec linux-g++ CONFIG+=qtquickcompiler PREFIX="$APPDIR_PREFIX"
16+
make qmake_all
17+
make -j"$(nproc)"
18+
make install
19+
linuxdeploy --appdir=AppDir -o appimage --custom-apprun="../installer-assets/appimage/AppRun" --plugin=qt --library="$LIBSSL1_OVERRIDE"

build_mac.sh

+23-15
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ set -exuo pipefail;
66

77
PROJECT="qFlipper";
88
BUILD_DIRECTORY="build_mac";
9-
LIBUSB_PATH="/opt/libs/libusb/1.0.24-universal";
109

1110
if [ -d ".git" ]; then
1211
git submodule update --init;
@@ -19,12 +18,27 @@ fi
1918

2019
if [[ "$(uname -m)" == "arm64" ]]; then
2120
eval "$(/opt/homebrew/bin/brew shellenv)";
22-
PATH="/opt/homebrew/qt-6.3.1-static/bin:$PATH";
23-
export PKG_CONFIG_PATH="$LIBUSB_PATH/lib/pkgconfig";
2421
else
2522
eval "$(/usr/local/Homebrew/bin/brew shellenv)";
2623
fi
2724

25+
if ! brew --version; then
26+
echo "Brew isn't installed!";
27+
exit 1;
28+
fi
29+
30+
if ! brew --prefix libusb_universal; then
31+
echo "Please install libusb_universal first!";
32+
printf "\tbrew install flipperdevices/homebrew-flipper/libusb_universal\n";
33+
exit 1;
34+
fi
35+
36+
if ! brew --prefix qt_universal; then
37+
echo "Please install qt_universal first!";
38+
printf "\tbrew install flipperdevices/homebrew-flipper/qt_universal\n";
39+
exit 1;
40+
fi
41+
2842
rm -rf "$BUILD_DIRECTORY";
2943
mkdir "$BUILD_DIRECTORY";
3044

@@ -43,7 +57,7 @@ make install;
4357

4458
# bundle libusb
4559
mkdir -p "$PROJECT.app/Contents/Frameworks";
46-
cp "$LIBUSB_PATH/lib/libusb-1.0.0.dylib" "$PROJECT.app/Contents/Frameworks";
60+
cp "$(brew --prefix libusb_universal)/lib/libusb-1.0.0.dylib" "$PROJECT.app/Contents/Frameworks";
4761

4862
relink_framework()
4963
{
@@ -89,14 +103,8 @@ if [ -n "${MAC_OS_SIGNING_KEY_ID:-""}" ]; then
89103
fi
90104

91105
# build DMG
92-
mkdir disk_image;
93-
mv "$PROJECT.app" "disk_image/";
94-
cp "../installer-assets/macos/DS_Store" "disk_image/.DS_Store";
95-
cp -r "../installer-assets/macos/background" "disk_image/.background";
96-
../scripts/create-dmg/create-dmg \
97-
--volname "$PROJECT-$(git describe --tags --abbrev=0)" \
98-
--volicon "../installer-assets/icons/${PROJECT}-installer.icns" \
99-
--skip-jenkins \
100-
--app-drop-link 485 150 \
101-
"$PROJECT.dmg" \
102-
"disk_image/";
106+
dmgbuild \
107+
-s "../installer-assets/macos/dmgbuild-config.py" \
108+
-D "app=$PROJECT.app" \
109+
"$PROJECT-$(git describe --tags --abbrev=0)" \
110+
"$PROJECT.dmg";

docker/Dockerfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ RUN add-apt-repository ppa:beineri/opt-qt-5.15.2-bionic && \
3131
qt515wayland \
3232
&& apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
3333

34-
RUN wget https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage -O /usr/bin/linuxdeploy \
34+
RUN wget https://update.flipperzero.one/builds/misc/linuxdeploy-x86_64-29092022.AppImage -O /usr/bin/linuxdeploy \
3535
&& chmod +x /usr/bin/linuxdeploy
3636

37-
RUN wget https://github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/download/continuous/linuxdeploy-plugin-qt-x86_64.AppImage -O /usr/bin/linuxdeploy-plugin-qt \
37+
RUN wget https://update.flipperzero.one/builds/misc/linuxdeploy-plugin-qt-x86_64-29092022.AppImage -O /usr/bin/linuxdeploy-plugin-qt \
3838
&& chmod +x /usr/bin/linuxdeploy-plugin-qt
3939

4040
RUN git config --global --replace-all safe.directory '*'

installer-assets/macos/DS_Store

-10 KB
Binary file not shown.
+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import os.path
2+
3+
application = defines.get('app', False)
4+
appname = os.path.basename(application)
5+
format = 'UDZO'
6+
files = [application]
7+
symlinks = {'Applications': '/Applications'}
8+
hide_extension = [application]
9+
icon = '../installer-assets/macos/VolumeIcon.icns'
10+
background = '../installer-assets/macos/background/qFlipper_disk_background.png'
11+
icon_locations = {
12+
appname: (125, 150),
13+
'Applications': (485, 150)
14+
}
15+
window_rect = ((200, 120), (600, 400))

scripts/build-libusb.sh

-30
This file was deleted.

scripts/build-static-qt.sh

-31
This file was deleted.

scripts/create-dmg

-1
This file was deleted.

0 commit comments

Comments
 (0)