Skip to content

Commit b40cace

Browse files
committed
AppImage support for PEB-based applications
1 parent 94c6481 commit b40cace

File tree

9 files changed

+118
-39
lines changed

9 files changed

+118
-39
lines changed

CREDITS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,7 @@ https://stackoverflow.com/questions/638975/how-do-i-tell-if-a-regular-file-does-
240240
https://stackoverflow.com/questions/10319652/check-if-a-file-is-executable
241241
https://stackoverflow.com/questions/10376206/what-is-the-preferred-bash-shebang
242242
https://stackoverflow.com/questions/192249/how-do-i-parse-command-line-arguments-in-bash
243+
https://stackoverflow.com/questions/2664740/extract-file-basename-without-path-and-extension-in-bash
243244

244245
https://unix.stackexchange.com/questions/312280/split-string-by-delimiter-and-get-n-th-element
245246
https://unix.stackexchange.com/questions/12453/how-to-determine-linux-kernel-architecture

doc/PACKAGING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ PEB or any PEB-based application can be easily packed as a 64-bit single-file Li
2323
* packing only a PEB executable with its Qt libraries:
2424

2525
```bash
26-
appimage-maker.sh
26+
appimage-maker.sh --no-resources
2727
```
2828

2929
In this case a PEB executable from an AppImage will try to find its application files and folders in the directory of the AppImage.
3030

31-
In both modes of operation the [AppImage Maker](https://github.com/ddmitov/perl-executing-browser/blob/master/sdk/appimage-maker.sh) uses the [linuxdeployqt](https://github.com/probonopd/linuxdeployqt/releases/) tool to detect all Qt dependencies of PEB and build the final image.
31+
In both modes of operation, the [AppImage Maker](https://github.com/ddmitov/perl-executing-browser/blob/master/sdk/appimage-maker.sh) uses the [linuxdeployqt](https://github.com/probonopd/linuxdeployqt/releases/) tool to detect all Qt dependencies of PEB and build the final image.
3232

3333
[AppImage Maker](https://github.com/ddmitov/perl-executing-browser/blob/master/sdk/appimage-maker.sh) script must be started from the ``{PEB_executable_directory}/sdk`` directory.

resources/app/perl-scripts/perl-info.pl

100644100755
File mode changed.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<component type="desktop-application">
3+
<id>peb-demo</id>
4+
<metadata_license>FSFAP</metadata_license>
5+
<project_license>LGPL-3.0</project_license>
6+
<name>PEB Demo</name>
7+
<summary>Perl Executing Browser Demo Package</summary>
8+
<description>
9+
<p>Perl Executing Browser (PEB) is an HTML5 user interface for Perl 5 desktop applications. By default it runs local Perl 5 scripts as child processes with no server and is implemented as a C++ executable based on the Qt 5 libraries. Inspired by Electron and NW.js, PEB is another reuse of web technologies in desktop applications with Perl doing the heavy lifting instead of Node.js.</p>
10+
</description>
11+
<launchable type="desktop-id">peb.desktop</launchable>
12+
<url type="homepage">https://github.com/ddmitov/perl-executing-browser</url>
13+
<screenshots>
14+
<screenshot type="default">
15+
<image>https://github.com/ddmitov/perl-executing-browser/raw/master/doc/screenshot.png</image>
16+
</screenshot>
17+
</screenshots>
18+
<provides>
19+
<id>peb.desktop</id>
20+
</provides>
21+
</component>
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[Desktop Entry]
2+
Version=1.0
3+
Type=Application
4+
Name=peb-demo
5+
Comment=HTML5 user interface for Perl 5 desktop applications
6+
Exec=peb-demo
7+
Icon=app
8+
Categories=Development;

sdk/appimage-maker.sh

Lines changed: 82 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -7,52 +7,101 @@ if [ ! "$(arch)" == "x86_64" ]; then
77
exit 1
88
fi
99

10-
if [ ! -e ./peb.app ]; then
11-
mkdir ./peb.app
12-
fi
13-
14-
if [ -e ./peb ]; then
15-
cp -f ./peb ./peb.app/peb
16-
else
17-
cd ./src || exit
18-
19-
qmake -qt=qt5
20-
make
21-
22-
cd .. || exit
23-
cp -f ./peb ./peb.app/peb
24-
fi
25-
26-
cp ./sdk/appimage/peb.desktop ./peb.app/peb.desktop
27-
cp ./src/resources/icon/camel.png ./peb.app/peb.png
28-
mkdir -p ./peb.app/usr/share/metainfo
29-
cp ./sdk/appimage/peb.appdata.xml ./peb.app/usr/share/metainfo/peb.appdata.xml
10+
mode="none"
3011

3112
for i in "$@"
3213
do
3314
case $i in
3415
--include-resources)
35-
cp -rf ./resources ./peb.app/resources
36-
cp ./resources/app.png ./peb.app/peb.png
37-
38-
relocatable_perl="$(pwd)/resources/app/perl/bin/perl"
39-
compactor_script="$(pwd)/sdk/compactor.pl"
40-
41-
if [ -e "$relocatable_perl" ]; then
42-
printf "\\nGoing to compact the relocatable Perl for this copy of Perl Executing Browser.\\n"
43-
"$relocatable_perl" "$compactor_script" "--AppImage"
44-
else
45-
printf "\\nRelocatable Perl is not found for this copy of Perl Executing Browser.\\n"
46-
fi
16+
mode="include-resources"
17+
;;
18+
esac
19+
20+
case $i in
21+
--no-resources)
22+
mode="no-resources"
4723
;;
4824
esac
4925
done
5026

27+
if [ $mode == "none" ]; then
28+
printf "\\nappimage-maker --include-resources\\n"
29+
printf "\\nto pack a PEB-based application or\\n"
30+
printf "\\nappimage-maker --no-resources\\n"
31+
printf "\\nto pack only a PEB executable\\n"
32+
exit 1
33+
fi
34+
35+
if [ ! -e "$(pwd)/peb" ]; then
36+
cd "$(pwd)/src" || exit
37+
38+
qmake -qt=qt5
39+
make
40+
41+
cd .. || exit
42+
fi
43+
5144
linuxdeployqt="linuxdeployqt-continuous-$(arch).AppImage"
5245

5346
if [ ! -x "$linuxdeployqt" ]; then
5447
wget --tries=5 --unlink "https://github.com/probonopd/linuxdeployqt/releases/download/continuous/linuxdeployqt-continuous-x86_64.AppImage"
5548
chmod -v a+x "$linuxdeployqt"
5649
fi
5750

58-
"./$linuxdeployqt" ./peb.app/peb -qmake='qmake -qt=qt5' -no-translations -appimage
51+
if [ $mode == "no-resources" ]; then
52+
rm -rf "$(pwd)/peb.app"
53+
mkdir "$(pwd)/peb.app"
54+
55+
cp "$(pwd)/peb" "$(pwd)/peb.app/peb"
56+
cp "$(pwd)/sdk/appimage/peb.desktop" "$(pwd)/peb.app/peb.desktop"
57+
cp "$(pwd)/src/resources/icon/camel.png" "$(pwd)/peb.app/app.png"
58+
59+
mkdir -p "$(pwd)/peb.app/usr/share/metainfo"
60+
cp "$(pwd)/sdk/appimage/peb.appdata.xml" "$(pwd)/peb.app/usr/share/metainfo/peb.appdata.xml"
61+
62+
"$(pwd)/$linuxdeployqt" "$(pwd)/peb.app/peb" -qmake='qmake -qt=qt5' -no-translations -appimage
63+
64+
rm -rf "$(pwd)/peb.app"
65+
fi
66+
67+
if [ $mode == "include-resources" ]; then
68+
package_desktop_file="$(ls ./resources/appimage/*.desktop)"
69+
if [ ! -e "$package_desktop_file" ]; then
70+
printf "\\nPackage .desktop file is missing!\\n"
71+
exit 1
72+
fi
73+
74+
package_name="$(basename "$package_desktop_file" .desktop)"
75+
76+
rm -rf "$(pwd)/$package_name.app"
77+
mkdir "$(pwd)/$package_name.app"
78+
79+
cp -f "$(pwd)/peb" "$(pwd)/$package_name.app/$package_name"
80+
cp -f "$package_desktop_file" "$(pwd)/$package_name.app/$package_name.desktop"
81+
cp -r "$(pwd)/resources" "$(pwd)/$package_name.app/resources"
82+
83+
if [ -e "$(pwd)/resources/app.png" ]; then
84+
cp -f "$(pwd)/resources/app.png" "$(pwd)/$package_name.app/app.png"
85+
fi
86+
87+
if [ -e "$(pwd)/resources/appimage/$package_name.appdata.xml" ]; then
88+
mkdir -p "$(pwd)/$package_name.app/usr/share/metainfo"
89+
cp -f "$(pwd)/resources/appimage/$package_name.appdata.xml" "$(pwd)/$package_name.app/usr/share/metainfo/$package_name.appdata.xml"
90+
fi
91+
92+
rm -rf "$(pwd)/$package_name.app/resources/appimage"
93+
94+
relocatable_perl="$(pwd)/resources/app/perl/bin/perl"
95+
compactor_script="$(pwd)/sdk/compactor.pl"
96+
97+
if [ -e "$relocatable_perl" ]; then
98+
printf "\\nGoing to compact the relocatable Perl for this copy of Perl Executing Browser.\\n"
99+
"$relocatable_perl" "$compactor_script" "--AppImage"
100+
else
101+
printf "\\nRelocatable Perl is not found for this copy of Perl Executing Browser.\\n"
102+
fi
103+
104+
"$(pwd)/$linuxdeployqt" "$(pwd)/$package_name.app/$package_name" -qmake='qmake -qt=qt5' -no-translations -appimage
105+
106+
rm -rf "$(pwd)/$package_name.app"
107+
fi

sdk/appimage/peb.appdata.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<id>peb</id>
44
<metadata_license>FSFAP</metadata_license>
55
<project_license>LGPL-3.0</project_license>
6-
<name>peb</name>
6+
<name>PEB</name>
77
<summary>HTML interface for Perl 5 desktop applications</summary>
88
<description>
99
<p>Perl Executing Browser (PEB) is an HTML5 user interface for Perl 5 desktop applications. By default it runs local Perl 5 scripts as child processes with no server and is implemented as a C++ executable based on the Qt 5 libraries. Inspired by Electron and NW.js, PEB is another reuse of web technologies in desktop applications with Perl doing the heavy lifting instead of Node.js.</p>

sdk/appimage/peb.desktop

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ Type=Application
44
Name=peb
55
Comment=HTML5 user interface for Perl 5 desktop applications
66
Exec=peb
7-
Icon=peb
7+
Icon=app
88
Categories=Development;

sdk/compactor.pl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@
3131
my $lib_compacted;
3232

3333
if ($ARGV[0] and $ARGV[0] =~ /^--AppImage$/) {
34-
$bin_compacted = catdir($root, "peb.app", "perl", "bin");
35-
$lib_compacted = catdir($root, "peb.app", "perl", "lib");
34+
$bin_compacted = catdir($root, "peb.app", "resources", "app", "perl", "bin");
35+
$lib_compacted = catdir($root, "peb.app", "resources", "app", "perl", "lib");
3636
} else {
3737
$bin_compacted = catdir($perl_directory, "bin-compacted");
3838
$lib_compacted = catdir($perl_directory, "lib-compacted");

0 commit comments

Comments
 (0)