ocran 1.4.2 → 1.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.txt +26 -0
- data/README.md +119 -24
- data/lib/ocran/build_facade.rb +2 -0
- data/lib/ocran/dir_builder.rb +3 -0
- data/lib/ocran/direction.rb +245 -23
- data/lib/ocran/ed_icon.rb +157 -0
- data/lib/ocran/gem_spec_queryable.rb +24 -3
- data/lib/ocran/inno_setup_script_builder.rb +15 -1
- data/lib/ocran/launcher_event_recorder.rb +29 -0
- data/lib/ocran/option.rb +7 -0
- data/lib/ocran/runner.rb +4 -2
- data/lib/ocran/stub_builder.rb +21 -6
- data/lib/ocran/version.rb +1 -1
- data/src/Makefile +2 -4
- data/src/inst_dir.c +44 -2
- data/src/inst_dir.h +14 -0
- data/src/stub.c +19 -8
- data/src/system_utils.c +26 -0
- data/src/system_utils.h +14 -0
- data/src/system_utils_posix.c +6 -0
- data/src/unpack.c +4 -0
- data/src/unpack.h +9 -0
- metadata +12 -25
- data/src/edicon.c +0 -161
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ocran
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.4.
|
|
4
|
+
version: 1.4.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Andi Idogawa
|
|
@@ -25,27 +25,13 @@ dependencies:
|
|
|
25
25
|
- - "~>"
|
|
26
26
|
- !ruby/object:Gem::Version
|
|
27
27
|
version: '1.0'
|
|
28
|
-
description:
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
- Self-extracting executable (.exe on Windows, native binary on Linux/macOS)
|
|
36
|
-
- Directory with a launch script (--output-dir)
|
|
37
|
-
- Zip archive with a launch script (--output-zip)
|
|
38
|
-
|
|
39
|
-
This is a fork of OCRA maintained for Ruby 3.2+ compatibility.
|
|
40
|
-
Migration guide: replace OCRA_EXECUTABLE with OCRAN_EXECUTABLE in your code.
|
|
41
|
-
|
|
42
|
-
Usage:
|
|
43
|
-
ocran helloworld.rb # builds helloworld.exe / helloworld
|
|
44
|
-
ocran --output-dir out/ app.rb
|
|
45
|
-
ocran --output-zip app.zip app.rb
|
|
46
|
-
|
|
47
|
-
See readme at https://github.com/largo/ocran
|
|
48
|
-
Report problems at https://github.com/largo/ocran/issues
|
|
28
|
+
description: 'OCRAN (One-Click Ruby Application Next) packages Ruby applications for
|
|
29
|
+
distribution on Windows, Linux, and macOS. It bundles your script, the Ruby interpreter,
|
|
30
|
+
gems, and native libraries into a self-contained artifact that runs without Ruby
|
|
31
|
+
installed on the target machine: a self-extracting executable (default), a directory
|
|
32
|
+
(--output-dir), a zip archive (--output-zip), or a macOS .app bundle (--macosx-bundle).
|
|
33
|
+
Fork of OCRA maintained for Ruby 3.2+; migrating code should replace OCRA_EXECUTABLE
|
|
34
|
+
with OCRAN_EXECUTABLE.'
|
|
49
35
|
email:
|
|
50
36
|
- andi@idogawa.com
|
|
51
37
|
executables:
|
|
@@ -66,12 +52,14 @@ files:
|
|
|
66
52
|
- lib/ocran/command_output.rb
|
|
67
53
|
- lib/ocran/dir_builder.rb
|
|
68
54
|
- lib/ocran/direction.rb
|
|
55
|
+
- lib/ocran/ed_icon.rb
|
|
69
56
|
- lib/ocran/empty_source
|
|
70
57
|
- lib/ocran/file_path_set.rb
|
|
71
58
|
- lib/ocran/gem_spec_queryable.rb
|
|
72
59
|
- lib/ocran/host_config_helper.rb
|
|
73
60
|
- lib/ocran/inno_setup_script_builder.rb
|
|
74
61
|
- lib/ocran/launcher_batch_builder.rb
|
|
62
|
+
- lib/ocran/launcher_event_recorder.rb
|
|
75
63
|
- lib/ocran/library_detector.rb
|
|
76
64
|
- lib/ocran/library_detector_posix.rb
|
|
77
65
|
- lib/ocran/option.rb
|
|
@@ -83,7 +71,6 @@ files:
|
|
|
83
71
|
- lib/ocran/windows_command_escaping.rb
|
|
84
72
|
- share/ocran/lzma.exe
|
|
85
73
|
- src/Makefile
|
|
86
|
-
- src/edicon.c
|
|
87
74
|
- src/error.c
|
|
88
75
|
- src/error.h
|
|
89
76
|
- src/inst_dir.c
|
|
@@ -110,7 +97,7 @@ licenses:
|
|
|
110
97
|
metadata:
|
|
111
98
|
homepage_uri: https://github.com/largo/ocran
|
|
112
99
|
source_code_uri: https://github.com/largo/ocran
|
|
113
|
-
changelog_uri: https://github.com/largo/ocran/CHANGELOG.txt
|
|
100
|
+
changelog_uri: https://github.com/largo/ocran/blob/master/CHANGELOG.txt
|
|
114
101
|
rdoc_options: []
|
|
115
102
|
require_paths:
|
|
116
103
|
- lib
|
|
@@ -125,7 +112,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
125
112
|
- !ruby/object:Gem::Version
|
|
126
113
|
version: '0'
|
|
127
114
|
requirements: []
|
|
128
|
-
rubygems_version: 4.0.
|
|
115
|
+
rubygems_version: 4.0.16
|
|
129
116
|
specification_version: 4
|
|
130
117
|
summary: OCRAN (One-Click Ruby Application Next) packages Ruby applications for distribution
|
|
131
118
|
on Windows, Linux, and macOS.
|
data/src/edicon.c
DELETED
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
Changes the Icon in a PE executable.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
#include <windows.h>
|
|
6
|
-
#include <stdio.h>
|
|
7
|
-
|
|
8
|
-
#pragma pack(push, 2)
|
|
9
|
-
|
|
10
|
-
/* Icon file header */
|
|
11
|
-
typedef struct
|
|
12
|
-
{
|
|
13
|
-
WORD Reserved;
|
|
14
|
-
WORD ResourceType;
|
|
15
|
-
WORD ImageCount;
|
|
16
|
-
} IconFileHeader;
|
|
17
|
-
|
|
18
|
-
/* Icon File directory entry structure */
|
|
19
|
-
typedef struct
|
|
20
|
-
{
|
|
21
|
-
BYTE Width;
|
|
22
|
-
BYTE Height;
|
|
23
|
-
BYTE Colors;
|
|
24
|
-
BYTE Reserved;
|
|
25
|
-
WORD Planes;
|
|
26
|
-
WORD BitsPerPixel;
|
|
27
|
-
DWORD ImageSize;
|
|
28
|
-
DWORD ImageOffset;
|
|
29
|
-
} IconDirectoryEntry;
|
|
30
|
-
|
|
31
|
-
/* Group Icon Resource directory entry structure */
|
|
32
|
-
typedef struct
|
|
33
|
-
{
|
|
34
|
-
BYTE Width;
|
|
35
|
-
BYTE Height;
|
|
36
|
-
BYTE Colors;
|
|
37
|
-
BYTE Reserved;
|
|
38
|
-
WORD Planes;
|
|
39
|
-
WORD BitsPerPixel;
|
|
40
|
-
DWORD ImageSize;
|
|
41
|
-
WORD ResourceID;
|
|
42
|
-
} IconDirResEntry, *PIconDirResEntry;
|
|
43
|
-
|
|
44
|
-
/* Group Icon Structore (RT_GROUP_ICON) */
|
|
45
|
-
typedef struct
|
|
46
|
-
{
|
|
47
|
-
WORD Reserved;
|
|
48
|
-
WORD ResourceType;
|
|
49
|
-
WORD ImageCount;
|
|
50
|
-
IconDirResEntry Enries[0]; /* Number of these is in ImageCount */
|
|
51
|
-
} GroupIcon;
|
|
52
|
-
|
|
53
|
-
#pragma pack(pop)
|
|
54
|
-
|
|
55
|
-
BOOL UpdateIcon(LPTSTR ExecutableFileName, LPTSTR IconFileName)
|
|
56
|
-
{
|
|
57
|
-
HANDLE h = BeginUpdateResource(ExecutableFileName, FALSE);
|
|
58
|
-
if (h == INVALID_HANDLE_VALUE)
|
|
59
|
-
{
|
|
60
|
-
printf("Failed to BeginUpdateResource\n");
|
|
61
|
-
return FALSE;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
/* Read the Icon file */
|
|
65
|
-
HANDLE hIconFile = CreateFile(IconFileName, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL);
|
|
66
|
-
if (hIconFile == INVALID_HANDLE_VALUE)
|
|
67
|
-
{
|
|
68
|
-
fprintf(stderr, "Failed to open icon file.\n");
|
|
69
|
-
return FALSE;
|
|
70
|
-
}
|
|
71
|
-
DWORD Size = GetFileSize(hIconFile, NULL);
|
|
72
|
-
BYTE* Data = LocalAlloc(LMEM_FIXED, Size);
|
|
73
|
-
DWORD BytesRead;
|
|
74
|
-
if (!ReadFile(hIconFile, Data, Size, &BytesRead, NULL))
|
|
75
|
-
{
|
|
76
|
-
fprintf(stderr, "Failed to read icon file.\n");
|
|
77
|
-
return FALSE;
|
|
78
|
-
}
|
|
79
|
-
CloseHandle(hIconFile);
|
|
80
|
-
|
|
81
|
-
IconFileHeader* header = (IconFileHeader*)Data;
|
|
82
|
-
IconDirectoryEntry* entries = (IconDirectoryEntry*)(header + 1);
|
|
83
|
-
|
|
84
|
-
/* Validate that all directory entries fit within the file */
|
|
85
|
-
DWORD entriesEnd = sizeof(IconFileHeader) + header->ImageCount * sizeof(IconDirectoryEntry);
|
|
86
|
-
if (entriesEnd > Size)
|
|
87
|
-
{
|
|
88
|
-
fprintf(stderr, "Icon file too small for declared ImageCount.\n");
|
|
89
|
-
LocalFree(Data);
|
|
90
|
-
return FALSE;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
/* Create the RT_ICON resources */
|
|
94
|
-
int i;
|
|
95
|
-
for (i = 0; i < header->ImageCount; ++i)
|
|
96
|
-
{
|
|
97
|
-
if (entries[i].ImageOffset + entries[i].ImageSize > Size)
|
|
98
|
-
{
|
|
99
|
-
fprintf(stderr, "Icon entry %d exceeds file bounds.\n", i);
|
|
100
|
-
LocalFree(Data);
|
|
101
|
-
return FALSE;
|
|
102
|
-
}
|
|
103
|
-
BOOL b = UpdateResource(h, MAKEINTRESOURCE(RT_ICON), MAKEINTRESOURCE(101 + i), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), Data + entries[i].ImageOffset, entries[i].ImageSize);
|
|
104
|
-
if (!b)
|
|
105
|
-
{
|
|
106
|
-
fprintf(stderr, "failed to UpdateResource %lu\n", GetLastError());
|
|
107
|
-
return FALSE;
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
/* Create the RT_GROUP_ICON structure */
|
|
112
|
-
DWORD GroupIconSize = sizeof(GroupIcon) + header->ImageCount * sizeof(IconDirectoryEntry);
|
|
113
|
-
GroupIcon* gi = (GroupIcon*)LocalAlloc(LMEM_FIXED, GroupIconSize);
|
|
114
|
-
gi->Reserved = 0;
|
|
115
|
-
gi->ResourceType = header->ResourceType;
|
|
116
|
-
gi->ImageCount = header->ImageCount;
|
|
117
|
-
for (i = 0; i < header->ImageCount; ++i)
|
|
118
|
-
{
|
|
119
|
-
IconDirResEntry* e = &gi->Enries[i];
|
|
120
|
-
e->Width = entries[i].Width;
|
|
121
|
-
e->Height = entries[i].Height;
|
|
122
|
-
e->Colors = entries[i].Colors;
|
|
123
|
-
e->Reserved = entries[i].Reserved;
|
|
124
|
-
e->Planes = entries[i].Planes;
|
|
125
|
-
e->BitsPerPixel = entries[i].BitsPerPixel;
|
|
126
|
-
e->ImageSize = entries[i].ImageSize;
|
|
127
|
-
e->ResourceID = 101 + i;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
/* Save the RT_GROUP_ICON resource */
|
|
131
|
-
BOOL b = UpdateResource(h, MAKEINTRESOURCE(RT_GROUP_ICON), MAKEINTRESOURCE(100), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), gi, GroupIconSize);
|
|
132
|
-
if (!b)
|
|
133
|
-
{
|
|
134
|
-
fprintf(stderr, "Failed to create group icon.\n");
|
|
135
|
-
return FALSE;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
if (!EndUpdateResource(h, FALSE))
|
|
139
|
-
{
|
|
140
|
-
fprintf(stderr, "Failed to EndUpdateResource.\n");
|
|
141
|
-
return FALSE;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
return TRUE;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
int main(int argc, char* argv[])
|
|
148
|
-
{
|
|
149
|
-
if (argc == 3)
|
|
150
|
-
{
|
|
151
|
-
if (UpdateIcon(argv[1], argv[2]))
|
|
152
|
-
return 0;
|
|
153
|
-
else
|
|
154
|
-
return -1;
|
|
155
|
-
}
|
|
156
|
-
else
|
|
157
|
-
{
|
|
158
|
-
fprintf(stderr, "Usage: edicon.exe <exefile> <icofile>\n");
|
|
159
|
-
return -1;
|
|
160
|
-
}
|
|
161
|
-
}
|