Skip to content

Commit 1452e36

Browse files
committed
Libraries build fixes
1 parent 75d5654 commit 1452e36

File tree

8 files changed

+93
-13
lines changed

8 files changed

+93
-13
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
### Fixed
1111
- Fix messy library builds
1212

13+
1314
## [0.1.1] - 2024-05-18
1415

1516
### Changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# PHPSAB - PHP Static Autobuilder
22

3-
![PHP Version](https://img.shields.io/badge/PHP-8.3.7-blue)
4-
![Builder](https://img.shields.io/badge/VS16-x64-a679dd)
5-
![PHPSAB Version](https://img.shields.io/badge/Version-0.1.1-red)
3+
![PHP Version](https://img.shields.io/badge/PHP-8.3.7-858eb7)
4+
![Builder](https://img.shields.io/badge/vs16-x64-a679dd)
5+
![PHPSAB Version](https://img.shields.io/badge/Version-0.1.1-blue)
66
![Status](https://img.shields.io/badge/Status-Active-green)
77

88

config.full.ini

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ win32std = Yes ; Mandatory (for res:// stream protocol)
1313
winbinder = Yes ; Windows Interface native support
1414
wcli = Yes ; Windows CLI native support
1515

16+
; win32ps = Yes ; Get processes informations
17+
; win32service = Yes ; Manage Windows services
18+
1619

1720
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1821
; Windows built-in extensions ;
@@ -109,6 +112,7 @@ wcli = Yes ; Windows CLI native support
109112
; pcsc = Yes
110113
; pecl_http = Yes
111114
; psr = Yes
115+
; rar = Yes
112116
; simdjson = Yes
113117
; ssh2 = Yes
114118
; stomp = Yes
@@ -120,8 +124,6 @@ wcli = Yes ; Windows CLI native support
120124
; translit = Yes
121125
; uopz = Yes
122126
; var_representation = Yes
123-
; win32service = Yes
124-
; win32ps = Yes
125127
; xdiff = Yes
126128
; xhprof = Yes
127129
; yac = Yes
@@ -165,6 +167,7 @@ wcli = Yes ; Windows CLI native support
165167
; componere
166168
; decimal
167169
; fann
170+
; grpc
168171
; http_message
169172
; judy
170173
; lua
@@ -191,5 +194,4 @@ wcli = Yes ; Windows CLI native support
191194
; "Deprecated error" extensions ;
192195
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
193196

194-
; rar ; From PECL
195197
; cmark

libraries/install_libevent.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,16 +60,20 @@
6060
$label = "Install " . $lib->name . '-' . $lib->version;
6161
draw_line($label, "running", Yellow);
6262
$builddir = $path . 'build\\';
63+
6364
$files[$path .'build-win\lib\Release\event.lib'] = 'lib\libevent.lib';
6465
$files[$path .'build-win\lib\Release\event_core.lib'] = 'lib\libevent_core.lib';
6566
$files[$path .'build-win\lib\Release\event_extra.lib'] = 'lib\libevent_extras.lib';
6667
$files[$path .'build-win\lib\Release\event_openssl.lib'] = 'lib\libevent_openssl.lib';
68+
6769
$inctmp = $path . 'include\\';
6870
foreach(dig($inctmp . '*.h') as $file)
6971
$files[$file] = 'include\\' . str_replace($inctmp, '', $file);
72+
7073
$inctmp = $path . 'build-win\include\\';
7174
foreach(dig($inctmp . '*.h') as $file)
7275
$files[$file] = 'include\\' . str_replace($inctmp, '', $file);
76+
7377
if(!create_build($builddir, $files)) draw_status($label, "failed", Red, true);
7478
if(!install_deps($builddir)) draw_status($label, "failed", Red, true);
7579
else draw_status($label, "complete", Green);

libraries/install_libxdiff.php

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
<?php
2+
3+
/**
4+
* ██╗ ██╗██████╗ ██╗ ██╗██████╗ ██╗███████╗███████╗
5+
* ██║ ██║██╔══██╗╚██╗██╔╝██╔══██╗██║██╔════╝██╔════╝
6+
* ██║ ██║██████╔╝ ╚███╔╝ ██║ ██║██║█████╗ █████╗
7+
* ██║ ██║██╔══██╗ ██╔██╗ ██║ ██║██║██╔══╝ ██╔══╝
8+
* ███████╗██║██████╔╝██╔╝ ██╗██████╔╝██║██║ ██║
9+
* ╚══════╝╚═╝╚═════╝ ╚═╝ ╚═╝╚═════╝ ╚═╝╚═╝ ╚═╝
10+
*/
11+
12+
13+
$path = ARCH_PATH . $lib->name . '-' . $lib->version . '\\';
14+
$xdifflog = LOG . 'libxdiff.log';
15+
16+
17+
// Download and unzip libxdiff
18+
$tmpfile = TMP.pathinfo($lib->download_url, PATHINFO_BASENAME);
19+
if(!download_file($lib->download_url, $tmpfile, pathinfo($tmpfile, PATHINFO_BASENAME))) exit_error();
20+
if(!untar($tmpfile, ARCH_PATH)) exit_error();
21+
if(!is_dir($path)) exit_error("Can't find untar results");
22+
23+
24+
// Patch makefile.win32
25+
$contents = file_get_contents($path . 'makefile.win32');
26+
$contents = str_replace(':I386', ':X64', $contents);
27+
file_put_contents($path . 'makefile.win32', $contents);
28+
29+
30+
// Compile libxdiff
31+
$label = "Compile " . $lib->name . '-' . $lib->version;
32+
draw_line($label, "running", Yellow);
33+
$bat = '@echo off'.RN;
34+
$bat .= 'cd ' . escapeshellarg($path).RN;
35+
$bat .= 'nmake /f makefile.win32 CFG=release'.RN;
36+
$batfile = TMP . 'build_libxdiff.bat';
37+
file_put_contents($batfile, $bat);
38+
$ret = shell_exec_vs16($batfile);
39+
file_put_contents($xdifflog, $ret);
40+
41+
42+
// Verify if the build works
43+
if(!is_file($path . 'release\xdiff.lib')) draw_status($label, "failed", Red, true, 'SEE: ' . $xdifflog);
44+
else draw_status($label, "complete", Green);
45+
46+
47+
// Install libxdiff
48+
$label = "Install " . $lib->name . '-' . $lib->version;
49+
draw_line($label, "running", Yellow);
50+
$builddir = $path . 'build\\';
51+
52+
$files[$path . 'release\xdiff.lib'] = 'lib\xdiff_a.lib';
53+
$files[$path . 'xdiff\xdiff.h'] = 'include\xdiff.h';
54+
55+
if(!create_build($builddir, $files)) draw_status($label, "failed", Red, true);
56+
if(!install_deps($builddir)) draw_status($label, "failed", Red, true);
57+
else draw_status($label, "complete", Green);
58+
59+
delete_parent_deps($lib->name);

matrix.json

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1078,6 +1078,18 @@
10781078
"switch": "--enable-var_representation",
10791079
"dependancies": [],
10801080
"libraries": []
1081+
},
1082+
{
1083+
"name": "rar",
1084+
"repo": "",
1085+
"url": "https://github.com/remicollet/php-rar/archive/refs/heads/issue-php82.zip",
1086+
"version": "4.2.0-1",
1087+
"archive": "php-rar-issue-php82",
1088+
"builtin": false,
1089+
"mandatory": false,
1090+
"switch": "--enable-rar",
1091+
"dependancies": [],
1092+
"libraries": []
10811093
}
10821094
],
10831095

@@ -1535,9 +1547,8 @@
15351547
{
15361548
"name": "libxdiff",
15371549
"version": "0.23",
1538-
"download_url": "https://windows.php.net/downloads/pecl/deps/libxdiff-0.23-vs16-x64.zip",
1539-
"install_script": "install_library.php",
1540-
"install_check": "lib\\xdiff_a.lib",
1550+
"download_url": "http://www.xmailserver.org/libxdiff-0.23.tar.gz",
1551+
"install_script": "install_libxdiff.php",
15411552
"mandatory": false,
15421553
"dependancies": []
15431554
},

php/install_extension.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@
3535
$tmpfile = preg_replace('#\.tgz$#i', '.tar.gz', $tmpfile);
3636

3737
if (!download_file($ext->url, $tmpfile, pathinfo($tmpfile, PATHINFO_BASENAME))) exit_error();
38-
if (!untar($tmpfile, EXT_PATH)) exit_error();
38+
if (pathinfo($tmpfile, PATHINFO_EXTENSION) == 'zip') {
39+
if (!unzip($tmpfile, EXT_PATH)) exit_error();
40+
} elseif (!untar($tmpfile, EXT_PATH)) exit_error();
3941

4042
if(!empty($ext->archive)) $tmpdir = EXT_PATH . $ext->archive;
4143
else $tmpdir = EXT_PATH . $ext->name . '-' . $ext->version;
@@ -58,7 +60,9 @@
5860
$tmpfile = preg_replace('#\.tgz$#i', '.tar.gz', $tmpfile);
5961

6062
if (!download_file($ext->url, $tmpfile, pathinfo($tmpfile, PATHINFO_BASENAME))) exit_error();
61-
if (!untar($tmpfile, EXT_PATH)) exit_error();
63+
if (pathinfo($tmpfile, PATHINFO_EXTENSION) == 'zip') {
64+
if (!unzip($tmpfile, EXT_PATH)) exit_error();
65+
} elseif (!untar($tmpfile, EXT_PATH)) exit_error();
6266

6367
if(!empty($ext->archive)) $tmpdir = EXT_PATH . $ext->archive;
6468
else $tmpdir = EXT_PATH . $ext->name . '-' . $ext->version;

phpsab.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
const CONFIG = DIR.'configs\\';
2323
const USER_AGENT = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36';
2424
const MAX_BUFFER_WIDTH = 100;
25-
const SPEED_DEV = true;
25+
const SPEED_DEV = false;
2626

2727

2828
draw_header("PHP Static Autobuilder");
@@ -362,7 +362,6 @@
362362
}
363363

364364

365-
366365
/**
367366
* Install PHP
368367
*/

0 commit comments

Comments
 (0)