Skip to content

Commit

Permalink
better windows compatibility and documentation update
Browse files Browse the repository at this point in the history
  • Loading branch information
ddmitov committed Jul 4, 2018
1 parent d71bea0 commit 06ba9a6
Show file tree
Hide file tree
Showing 11 changed files with 25 additions and 29 deletions.
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ Perl Executing Browser (PEB) is an HTML5 user interface for [Perl 5](https://www

## Screenshots

![PEB Main Window](https://github.com/ddmitov/perl-executing-browser/raw/master/doc/screenshots/peb-main.png "PEB Main Window")

![Reading Local Files](https://github.com/ddmitov/perl-executing-browser/raw/master/doc/screenshots/peb-local-files.png "Reading Local Files")
![PEB Screenshot](https://github.com/ddmitov/perl-executing-browser/raw/master/doc/screenshot.png "PEB Screenshot")

## Contents
* [Quick Start](#quick-start)
Expand All @@ -36,9 +34,10 @@ Perl Executing Browser (PEB) is an HTML5 user interface for [Perl 5](https://www
* [Interactive Perl Scripts](./doc/SETTINGS.md#interactive-perl-scripts)
* [Starting Local Server](./doc/SETTINGS.md#starting-local-server)
* [Selecting Files and Folders](./doc/SETTINGS.md#selecting-files-and-folders)
* [Minimal Portable Perl Distribution for PEB](./doc/SETTINGS.md#minimal-portable-perl-distribution-for-peb)
* [AppImage Support](./doc/SETTINGS.md#appimage-support)
* [Log Files](./doc/SETTINGS.md#log-files)
* [PACKAGING](./doc/PACKAGING.md)
* [Minimal Portable Perl Distribution for PEB](./doc/PACKAGING.md#minimal-portable-perl-distribution-for-peb)
* [AppImage Support](./doc/PACKAGING.md#appimage-support)
* [History](#history)
* [License](./LICENSE.md)
* [Thanks and Credits](./doc/CREDITS.md)
Expand Down
2 changes: 1 addition & 1 deletion doc/CONSTANTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Perl Executing Browser - Constants

## Hard Coded Files and Folders
* **Perl interpreter:**
PEB expects to find a Perl interpreter in the ``{PEB_binary_directory}/perl/bin`` folder. The interpreter must be named ``perl`` on Linux and Mac machines and ``perl.exe`` on Windows machines. If Perl interpreter is not found in the above location, PEB will use the first Perl interpreter on PATH.
PEB expects to find a Perl interpreter in the ``{PEB_binary_directory}/perl/bin`` folder. The interpreter must be named ``perl`` on Linux and Mac machines and ``wperl.exe`` on Windows machines. If Perl interpreter is not found in the above location, PEB will use the first Perl interpreter on PATH.

* **Resources directory:**
Resources directory is ``{PEB_binary_directory}/resources`` or ``{AppImage_binary_directory}/resources`` if a PEB-based application is packed as an [AppImage](https://appimage.org/). Application, data and logs directories, as well as icon file of a PEB application must be located in this folder.
Expand Down
12 changes: 12 additions & 0 deletions doc/PACKAGING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Perl Executing Browser - Packaging
--------------------------------------------------------------------------------

## Minimal Portable Perl Distribution for PEB
Sometimes it is important to minimize the size of the relocatable (or portable) Perl distribution used by a PEB-based application. [Perl Distribution Compactor](sdk/compactor.pl) is one solution for this problem. It finds all dependencies of all Perl scripts in the ``{PEB_binary_directory}/resources/app`` directory and copies them in a new ``{PEB_binary_directory}/perl/lib`` folder; a new ``{PEB_binary_directory}/perl/bin`` is also created. The original ``bin`` and ``lib`` folders may be saved as ``bin-original`` and ``lib-original`` respectively.

Perl Distribution Compactor should be started using [compactor.sh](sdk/compactor.sh) on a Linux machine or [compactor.cmd](sdk/compactor.cmd) on a Windows machine to ensure that only the Perl distribution of PEB is used. This is necessary to avoid dependency mismatches with any other Perl on PATH.

Perl Distribution Compactor depends on [Module::ScanDeps](https://metacpan.org/pod/Module::ScanDeps) and [File::Copy::Recursive](https://metacpan.org/pod/File::Copy::Recursive) CPAN modules, which are included in the ``{PEB_binary_directory}/sdk/lib`` folder.

## AppImage Support
Any PEB-based application can be easily packed as a single executable Linux [AppImage](https://appimage.org/) file including the PEB binary, all necessary Qt libraries, relocatable Perl distribution and all application files. This can be easily achieved by the [AppImage Maker](sdk/appimage-maker.sh) script. It finds all dependencies of all Perl scripts in the ``{PEB_binary_directory}/resources/app`` directory and copies only the necessary Perl modules using the [Perl Distribution Compactor](sdk/compactor.pl). All Qt dependencies are detected and the final image is built using a special version of the [linuxdeployqt](https://github.com/probonopd/linuxdeployqt/releases/) binary.
12 changes: 1 addition & 11 deletions doc/SETTINGS.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ The following code shows how to start an interactive Perl script right after a l
</html>
```

The [index.htm](./resources/app/index.html) file of the demo package demonstrates how to start one script in two instances immediately after a page is loaded.
The [index.htm](https://github.com/ddmitov/perl-executing-browser/blob/master/resources/app/index.html) file of the demo package demonstrates how to start one script in two instances immediately after local page is loaded.

## Starting Local Server
A [Mojolicious](http://mojolicious.org/) application or other local Perl server can be started by PEB provided that a ``{PEB_binary_directory}/resources/app/local-server.json`` file is found instead of ``{PEB_binary_directory}/resources/app/index.html`` with the following structure:
Expand Down Expand Up @@ -219,15 +219,5 @@ select_file.receiverFunction = function (file) {
* When using the ``directory`` type of dialog, an existing or a new directory may be selected.
Any new directory will be created immediately by PEB.

## Minimal Portable Perl Distribution for PEB
Sometimes it is important to minimize the size of the relocatable (or portable) Perl distribution used by a PEB-based application. [Perl Distribution Compactor](sdk/compactor.pl) is one solution for this problem. It finds all dependencies of all Perl scripts in the ``{PEB_binary_directory}/resources/app`` directory and copies them in a new ``{PEB_binary_directory}/perl/lib`` folder; a new ``{PEB_binary_directory}/perl/bin`` is also created. The original ``bin`` and ``lib`` folders may be saved as ``bin-original`` and ``lib-original`` respectively.

Perl Distribution Compactor should be started using [compactor.sh](sdk/compactor.sh) on a Linux machine or [compactor.cmd](sdk/compactor.cmd) on a Windows machine to ensure that only the Perl distribution of PEB is used. This is necessary to avoid dependency mismatches with any other Perl on PATH.

Perl Distribution Compactor depends on [Module::ScanDeps](https://metacpan.org/pod/Module::ScanDeps) and [File::Copy::Recursive](https://metacpan.org/pod/File::Copy::Recursive) CPAN modules, which are included in the ``{PEB_binary_directory}/sdk/lib`` folder.

## AppImage Support
Any PEB-based application can be easily packed as a single executable Linux [AppImage](https://appimage.org/) file including the PEB binary, all necessary Qt libraries, relocatable Perl distribution and all application files. This can be easily achieved by the [AppImage Maker](sdk/appimage-maker.sh) script. It finds all dependencies of all Perl scripts in the ``{PEB_binary_directory}/resources/app`` directory and copies only the necessary Perl modules using the [Perl Distribution Compactor](sdk/compactor.pl). All Qt dependencies are detected and the final image is built using a special version of the [linuxdeployqt](https://github.com/probonopd/linuxdeployqt/releases/) binary.

## Log Files
If log files are needed for debugging of PEB or a PEB-based application, they can easily be turned on by manually creating ``{PEB_binary_directory}/resources/logs`` or ``{AppImage_binary_directory}/resources/logs`` if a PEB-based application is packed as an [AppImage](https://appimage.org/). If this directory is found during application startup, the browser assumes that logging is required and a separate log file is created for every browser session following the naming convention: ``{application_name}-started-at-{four_digit_year}-{month}-{day}--{hour}-{minute}-{second}.log``. PEB will not create ``{PEB_binary_directory}/logs`` on its own and if this directory is missing, no logs will be written.
File renamed without changes
Binary file removed doc/screenshots/peb-local-files.png
Binary file not shown.
2 changes: 1 addition & 1 deletion sdk/compactor.pl
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
}

if ($Config{osname} =~ "MSWin32") {
fcopy(catdir($bin_original, "wperl.exe"), catdir($bin_compacted, "perl.exe"));
fcopy(catdir($bin_original, "wperl.exe"), catdir($bin_compacted, "wperl.exe"));

my @libraries = traverse_directory($bin_original, ".dll");
foreach my $library (@libraries) {
Expand Down
11 changes: 3 additions & 8 deletions sdk/metainfo
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,8 @@
​ <screenshots>
​ <screenshot type="default">
​ <caption>PEB Main Window</caption>
​ <image>https://github.com/ddmitov/perl-executing-browser/raw/master/screenshots/peb-main.png</image>
​ </screenshot>

​ <screenshot>
<caption>Reading Local Files</caption>
​ <image>https://github.com/ddmitov/perl-executing-browser/raw/master/screenshots/peb-local-files.png</image>
​ <caption>PEB Screenshot</caption>
​ <image>https://github.com/ddmitov/perl-executing-browser/raw/master/doc/screenshot.png</image>
​ </screenshot>
​ </screenshots>
Expand All @@ -37,7 +32,7 @@
​ </provides>
​ <releases>
​ <release version="0.7.1" date="2018-06-16">
​ <release version="0.7.2" date="2018-06-16">
​ <description>
​ <p>better AppImage support</p>
​ </description>
Expand Down
2 changes: 1 addition & 1 deletion sdk/peb.desktop
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Version=1.0
Type=Application
Name=peb
Comment=HTML interface for Perl 5 desktop applications
Comment=HTML5 user interface for Perl 5 desktop applications
Exec=peb
Icon=peb
Categories=Development;
2 changes: 1 addition & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ int main(int argc, char **argv)
#endif

#ifdef Q_OS_WIN
perlExecutable = "perl.exe";
perlExecutable = "wperl.exe";
#endif

QString perlInterpreter;
Expand Down
2 changes: 1 addition & 1 deletion src/resources/peb.rc
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ VS_VERSION_INFO VERSIONINFO
BEGIN
VALUE "CompanyName", "PEB Dev Team\0"
VALUE "FileDescription", "Perl Executing Browser\0"
VALUE "FileVersion", "0.6.0.0\0"
VALUE "FileVersion", "0.7.2.0\0"
VALUE "LegalCopyright", "LGPL v.3\0"
VALUE "OriginalFilename", "peb.exe\0"
VALUE "ProductName", "Perl Executing Browser\0"
Expand Down

0 comments on commit 06ba9a6

Please sign in to comment.