Skip to content

Commit ab977d5

Browse files
snap: build lazarus sdk from source
Reason for change: - Ubuntu default lazarus via apt get is not the latest version. - Need to build from source to get the latest Arm64 version.
1 parent 2026168 commit ab977d5

File tree

1 file changed

+59
-25
lines changed

1 file changed

+59
-25
lines changed

snap/snapcraft.yaml

Lines changed: 59 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -12,44 +12,78 @@ architectures:
1212

1313
apps:
1414
bittorrent-tracker-editor:
15-
desktop: mainprogram/io.github.gerryferdinandus.bittorrent-tracker-editor.desktop
1615
extensions:
1716
- kde-neon
18-
command: mainprogram/trackereditor
17+
command: trackereditor
1918
environment:
2019
# Fallback to XWayland if running in a Wayland session.
2120
DISABLE_WAYLAND: 1
2221
plugs:
2322
- home
2423
- network
2524
- removable-media
26-
- pulseaudio
2725

2826
parts:
29-
mainprogram: # Build and add to snap the main program: mainprogram/trackereditor
30-
source: https://github.com/GerryFerdinandus/bittorrent-tracker-editor.git
31-
parse-info: [metainfo/io.github.gerryferdinandus.bittorrent-tracker-editor.metainfo.xml]
27+
build_lazarus:
28+
source: .
3229
plugin: nil
33-
override-build: |
34-
craftctl default
35-
lazbuild --build-mode=Release --widgetset=qt5 source/project/tracker_editor/trackereditor.lpi
36-
mkdir $CRAFT_PART_INSTALL/mainprogram
37-
cp enduser/trackereditor $CRAFT_PART_INSTALL/mainprogram
38-
cp metainfo/io.github.gerryferdinandus.bittorrent-tracker-editor.desktop $CRAFT_PART_INSTALL/mainprogram
3930
build-packages:
4031
- fpc
41-
- lazarus
42-
- libqt5pas-dev
32+
- libqt5x11extras5-dev
33+
build-environment:
34+
- LAZARUS_URL_TAR_GZ: "https://sourceforge.net/projects/lazarus/files/Lazarus%20Zip%20_%20GZip/Lazarus%203.4/lazarus-3.4-0.tar.gz"
35+
- LAZARUS_QT_VERSION: "5"
36+
- LIB_DIR: "/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR"
37+
- LAZARUS_DIR: "$PWD/lazarus"
38+
override-build: |
39+
# Remove the older libQTpas.so
40+
rm -f $LIB_DIR/libQt${LAZARUS_QT_VERSION}Pas.*
4341
44-
libQt5Pas: # Add to snap the libQt5Pas support library : usr/lib/*/libQt5Pas.*
45-
plugin: nil
46-
stage-packages:
47-
- libqt5pas1
48-
prime:
49-
- usr/lib/*/libQt5Pas.*
50-
51-
# Only 3 files are explicitly added in this snap:
52-
# trackereditor + .desktop file via copy command
53-
# libQt5Pas.so via prime
42+
#Download lazarus source code. Directory 'lazarus' will be created in the root.
43+
curl -L -O $LAZARUS_URL_TAR_GZ
44+
tar -xzf *.tar.gz
45+
46+
# Create libQTpas.so and put it in snap $CRAFT_PART_INSTALL
47+
cd "$LAZARUS_DIR/lcl/interfaces/qt${LAZARUS_QT_VERSION}/cbindings/"
48+
qmake
49+
make -j$(nproc)
50+
make install
51+
cp -av --parents $LIB_DIR/libQt${LAZARUS_QT_VERSION}Pas.* $CRAFT_PART_INSTALL
52+
53+
# make lazbuild and put the link with extra parameter in /usr/bin/
54+
cd "$LAZARUS_DIR"
55+
make lazbuild
56+
echo "$LAZARUS_DIR/lazbuild --primary-config-path=$LAZARUS_DIR --lazarusdir=$LAZARUS_DIR \$*" > /usr/bin/lazbuild
57+
chmod 777 /usr/bin/lazbuild
58+
59+
mainprogram: # Build and add to snap the main program: trackereditor
60+
after: [build_lazarus]
61+
source: .
62+
plugin: nil
63+
parse-info: [metainfo/io.github.gerryferdinandus.bittorrent-tracker-editor.metainfo.xml]
64+
override-build: |
65+
lazbuild --build-mode=Release --widgetset=qt5 source/project/tracker_editor/trackereditor.lpi
66+
install enduser/trackereditor $CRAFT_PART_INSTALL/
67+
68+
# --------------------------------------------------------------
69+
# Only 2 files are explicitly added in this snap
70+
# - main program: enduser/trackereditor
71+
# - Lazarus QT suport library: libQt5Pas.so
72+
#
73+
# Create snap. Run from the project root folder:
74+
# snapcraft --verbosity verbose
75+
#
76+
# he snapTo look what is inside t file. Directory 'squashfs-root' will be created in the root folder:
77+
# unsquashfs *.snap
78+
#
79+
# Install the snap:
80+
# sudo snap install --devmode ./*.snap
5481
#
55-
# Use: 'unsquashfs *.snap' to look what is inside the snap file.
82+
# Run the snap
83+
# snap run bittorrent-tracker-editor
84+
# --------------------------------------------------------------
85+
# Todo: building for QT6 is still not working with snap
86+
# https://askubuntu.com/questions/1460242/ubuntu-22-04-with-qt6-qmake-could-not-find-a-qt-installation-of
87+
# qtchooser -install qt{LAZARUS_QT_VERSION} $(which qmake6)
88+
# export QT_SELECT=qt{LAZARUS_QT_VERSION}
89+
# --------------------------------------------------------------

0 commit comments

Comments
 (0)