Skip to content

Commit c782814

Browse files
committed
relocatable Perl directory inside application directory
1 parent 9f6fa33 commit c782814

File tree

18 files changed

+92
-106
lines changed

18 files changed

+92
-106
lines changed

.gitignore

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
archive/
22
build-peb-*/
3-
perl/bin
4-
perl/lib
3+
resources/app/perl
54
src/tmp
65

6+
.qmake.stash
77
*.autosave
88
Makefile
9+
peb.pro.*
10+
911
peb
1012
peb.exe
11-
peb.pro.*
1213

1314
test.db
1415

doc/CONSTANTS.md

Lines changed: 40 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -10,74 +10,75 @@ A typical ``{PEB_executable_directory}`` looks like this:
1010
```bash
1111
.
1212
├── {PEB_executable}
13-
├── perl
14-
│   ├── bin
15-
│   │   └── {perl_interpreter}
16-
│   └── lib
17-
│   └── {perl_modules}
1813
└── resources
1914
   ├── app
2015
   │   └── index.html
21-
   ├── app.png
2216
  ├── data
2317
   │ └── {application_data}
24-
└── logs
25-
   └── {application_logs}
18+
├── perl
19+
│   ├── bin
20+
│   │   └── {perl_interpreter}
21+
│   └── lib
22+
│   └── {perl_modules}
23+
└── app.png
2624
```
2725

28-
* **Perl Directory:**
29-
The Perl directory, if present, must contain the ``bin`` and ``lib`` subdirectories.
30-
The ``bin`` subdirectory must contain the Perl interpreter.
31-
The ``lib`` subdirectory must contain all Perl modules used by PEB Perl applications.
32-
33-
* **Perl Interpreter:**
34-
Relocatable Perl interpreter, if present, must be located in the ``{PEB_executable_directory}/perl/bin`` folder.
35-
The Perl interpreter must be named ``perl`` on Linux and Mac machines and ``wperl.exe`` on Windows machines.
36-
If a relocatable Perl interpreter is not found, PEB will use the first Perl interpreter on PATH.
37-
38-
* **Perl Modules Directory:**
39-
All Perl modules found in the ``{PEB_executable_directory}/perl/lib`` folder are accessible via the ``PERL5LIB`` environment variable for all Perl applications executed by PEB.
40-
4126
* **Resources Directory:**
4227
The resources directory must contain the ``app`` subdirectory with all necessary application files.
43-
``data`` subdirectory and the application icon file ``app.png`` are optional.
28+
``data`` and ``perl`` subdirectories, as well as the application icon file ``app.png`` are optional.
29+
4430
The resources directory path must be: ``{PEB_executable_directory}/resources``
4531

4632
* **Application Directory:**
4733
All Perl application files must be located within this folder.
48-
The application directory path must be: ``{PEB_executable_directory}/resources/app``
4934
PEB application directory is labeled as ``{PEB_app_directory}`` within this documentation.
5035
By default the working directory of all Perl scripts run by PEB is the application directory.
5136

37+
The application directory path must be: ``{PEB_executable_directory}/resources/app``
38+
5239
PEB application directory pathname is compatible with the [Electron](http://electron.atom.io/) framework.
5340
[Epigraphista](https://github.com/ddmitov/epigraphista) is an application which is runnable by both PEB and [Electron](http://electron.atom.io/).
5441

55-
* **Start File:**
56-
PEB starts with one of the following files:
57-
* ``{PEB_executable_directory}/resources/app/index.html``
58-
* ``{PEB_executable_directory}/resources/app/local-server.json``
42+
* **Start File:**
43+
PEB starts with one of the following files:
44+
* ``{PEB_executable_directory}/resources/app/index.html``
45+
* ``{PEB_executable_directory}/resources/app/local-server.json``
5946

60-
If both files are present, ``index.html`` takes precedence.
61-
If ``index.html`` is missing, ``local-server.json`` is used if available.
62-
If both entry files are missing, an error message is displayed.
63-
64-
<a name="icon"></a>
65-
* **Icon:**
66-
A PEB-based application may have its own icon and the pathname must be:
67-
``{PEB_executable_directory}/resources/app.png``
68-
69-
If this file is found during application startup, it is used as the icon of the application and all dialog boxes.
70-
If this file is not found, the default icon embedded in the resources of the browser binary is used.
47+
If both files are present, ``index.html`` takes precedence.
48+
If ``index.html`` is missing, ``local-server.json`` is used if available.
49+
If both entry files are missing, an error message is displayed.
7150

7251
* **Data Directory:**
7352
Data directory may contain any writable files used or produced by a PEB-based application.
53+
Perl scripts can access this folder using the environment variable ``PEB_DATA_DIR``:
54+
7455
The data directory path must be: ``{PEB_executable_directory}/resources/data``
75-
Perl scripts can access this folder using the environment variable ``PEB_DATA_DIR``:
7656

7757
```perl
7858
my $data_directory = $ENV{'PEB_DATA_DIR'};
7959
```
8060

61+
* **Perl Directory:**
62+
The Perl directory, if present, must contain the ``bin`` and ``lib`` subdirectories.
63+
The ``bin`` subdirectory must contain the Perl interpreter.
64+
The ``lib`` subdirectory must contain all Perl modules used by PEB Perl applications.
65+
66+
* **Perl Interpreter:**
67+
Relocatable Perl interpreter, if present, must be located in the ``{PEB_executable_directory}/resources/perl/bin`` folder.
68+
The Perl interpreter must be named ``perl`` on Linux and Mac machines and ``wperl.exe`` on Windows machines.
69+
If a relocatable Perl interpreter is not found, PEB will use the first Perl interpreter on PATH.
70+
71+
* **Perl Modules Directory:**
72+
All Perl modules found in the ``{PEB_executable_directory}/resources/perl/lib`` folder are accessible via the ``PERL5LIB`` environment variable for all Perl applications executed by PEB.
73+
74+
<a name="icon"></a>
75+
* **Icon:**
76+
A PEB-based application may have its own icon and the pathname must be:
77+
``{PEB_executable_directory}/resources/app.png``
78+
79+
If this file is found during application startup, it is used as the icon of the application and all dialog boxes.
80+
If this file is not found, the default icon embedded in the resources of the browser binary is used.
81+
8182
## Functional Pseudo Filenames
8283
* **About PEB dialog:** ``about-browser.function``
8384

doc/PACKAGING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Perl Executing Browser - Packaging
22
--------------------------------------------------------------------------------
33

44
## Minimal Relocatable Perl Distribution for PEB
5-
Minimizing the size of a relocatable (or portable) Perl distribution used by a PEB-based application is vital for reducing the size of its distribution package. [Perl Distribution Compactor](https://github.com/ddmitov/perl-executing-browser/blob/master/sdk/compactor.pl) is one solution for this problem. It finds all dependencies of all Perl scripts in the ``{PEB_executable_directory}/resources/app`` directory and copies them in a new ``{PEB_executable_directory}/perl/lib`` folder, a new ``{PEB_executable_directory}/perl/bin`` is also created. Any unnecessary modules are left behind and the original ``bin`` and ``lib`` folders are saved as ``bin-original`` and ``lib-original``.
5+
Minimizing the size of a relocatable (or portable) Perl distribution used by a PEB-based application is vital for reducing the size of its distribution package. [Perl Distribution Compactor](https://github.com/ddmitov/perl-executing-browser/blob/master/sdk/compactor.pl) is one solution for this problem. It finds all dependencies of all Perl scripts in the ``{PEB_executable_directory}/resources/app`` directory and copies them in a new ``{PEB_executable_directory}/resources/app/perl/lib`` folder, a new ``{PEB_executable_directory}/resources/app/perl/bin`` is also created. Any unnecessary modules are left behind and the original ``bin`` and ``lib`` folders are saved as ``bin-original`` and ``lib-original``.
66

77
Perl Distribution Compactor must be started from the ``{PEB_executable_directory}/sdk/lib`` folder using [compactor.sh](https://github.com/ddmitov/perl-executing-browser/blob/master/sdk/compactor.sh) on a Linux machine or [compactor.cmd](https://github.com/ddmitov/perl-executing-browser/blob/master/sdk/compactor.cmd) on a Windows machine to ensure that only the relocatable Perl distribution of PEB is used. This is necessary to avoid dependency mismatches with any other Perl on PATH.
88

resources/app/index-windows.html

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
// Settings objects for the Perl scripts:
2626
var perl_input = {};
27-
perl_input.scriptRelativePath = 'perl/input.pl';
27+
perl_input.scriptRelativePath = 'perl-scripts/input.pl';
2828
perl_input.inputData = function() {
2929
var data = document.getElementById('perl-input-box').value;
3030
$('#perl-input').trigger('reset');
@@ -36,7 +36,7 @@
3636
}
3737

3838
var clock_one = {};
39-
clock_one.scriptRelativePath = 'perl/clock.pl';
39+
clock_one.scriptRelativePath = 'perl-scripts/clock.pl';
4040
clock_one.inputData = function() {
4141
return "unix-epoch";
4242
}
@@ -46,7 +46,7 @@
4646
}
4747

4848
var clock_two = {};
49-
clock_two.scriptRelativePath = 'perl/clock.pl';
49+
clock_two.scriptRelativePath = 'perl-scripts/clock.pl';
5050
clock_two.inputData = function() {
5151
return "local-time";
5252
}
@@ -56,25 +56,25 @@
5656
}
5757

5858
var open_files = {};
59-
open_files.scriptRelativePath = 'perl/open-files.pl';
59+
open_files.scriptRelativePath = 'perl-scripts/open-files.pl';
6060
open_files.stdoutFunction = function (stdout) {
6161
displayTestResult(stdout);
6262
}
6363

6464
var open_directory = {};
65-
open_directory.scriptRelativePath = 'perl/open-directory.pl';
65+
open_directory.scriptRelativePath = 'perl-scripts/open-directory.pl';
6666
open_directory.stdoutFunction = function (stdout) {
6767
displayTestResult(stdout);
6868
}
6969

7070
var perl_info = {};
71-
perl_info.scriptRelativePath = 'perl/perl-info.pl';
71+
perl_info.scriptRelativePath = 'perl-scripts/perl-info.pl';
7272
perl_info.stdoutFunction = function (stdout) {
7373
displayTestResult(stdout);
7474
}
7575

7676
var sqlite = {};
77-
sqlite.scriptRelativePath = 'perl/sqlite.pl';
77+
sqlite.scriptRelativePath = 'perl-scripts/sqlite.pl';
7878
sqlite.stdoutFunction = function (stdout) {
7979
displayTestResult(stdout);
8080
}

resources/app/index.html

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
// Settings objects for the Perl scripts:
2626
var interactive_one = {};
27-
interactive_one.scriptRelativePath = 'perl/interactive.pl';
27+
interactive_one.scriptRelativePath = 'perl-scripts/interactive.pl';
2828
interactive_one.inputData = function() {
2929
var data = $('#form-one').serialize();
3030
$('#form-one').trigger('reset');
@@ -36,7 +36,7 @@
3636
}
3737

3838
var interactive_two = {};
39-
interactive_two.scriptRelativePath = 'perl/interactive.pl';
39+
interactive_two.scriptRelativePath = 'perl-scripts/interactive.pl';
4040
interactive_two.inputData = function() {
4141
var data = $('#form-two').serialize();
4242
$('#form-two').trigger('reset');
@@ -48,25 +48,25 @@
4848
}
4949

5050
var open_files = {};
51-
open_files.scriptRelativePath = 'perl/open-files.pl';
51+
open_files.scriptRelativePath = 'perl-scripts/open-files.pl';
5252
open_files.stdoutFunction = function (stdout) {
5353
displayTestResult(stdout);
5454
}
5555

5656
var open_directory = {};
57-
open_directory.scriptRelativePath = 'perl/open-directory.pl';
57+
open_directory.scriptRelativePath = 'perl-scripts/open-directory.pl';
5858
open_directory.stdoutFunction = function (stdout) {
5959
displayTestResult(stdout);
6060
}
6161

6262
var perl_info = {};
63-
perl_info.scriptRelativePath = 'perl/perl-info.pl';
63+
perl_info.scriptRelativePath = 'perl-scripts/perl-info.pl';
6464
perl_info.stdoutFunction = function (stdout) {
6565
displayTestResult(stdout);
6666
}
6767

6868
var sqlite = {};
69-
sqlite.scriptRelativePath = 'perl/sqlite.pl';
69+
sqlite.scriptRelativePath = 'perl-scripts/sqlite.pl';
7070
sqlite.stdoutFunction = function (stdout) {
7171
displayTestResult(stdout);
7272
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)