Skip to content

Commit c1a3e8f

Browse files
committed
Add latest libXpm 3.5.17
1 parent b53af16 commit c1a3e8f

File tree

4 files changed

+114
-5
lines changed

4 files changed

+114
-5
lines changed

libraries/install_libjpeg-turbo.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
draw_line($label, "running", Yellow);
5555
$builddir = $path . 'build\\';
5656

57-
$files[$path . 'build-win\Release\jpeg-static.lib'] = 'lib\libjpeg_a.lib';
57+
$files[$path . 'build-win\Release\turbojpeg-static.lib'] = 'lib\libjpeg_a.lib';
5858
$files[$path . 'build-win\jconfig.h'] = 'include\jconfig.h';
5959
$files[$path . 'build-win\jversion.h'] = 'include\jversion.h';
6060
$files[$path . 'jerror.h'] = 'include\jerror.h';

libraries/install_libxpm.php

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
<?php
2+
3+
/**
4+
* ██╗ ██╗██████╗ ██╗ ██╗██████╗ ███╗ ███╗
5+
* ██║ ██║██╔══██╗╚██╗██╔╝██╔══██╗████╗ ████║
6+
* ██║ ██║██████╔╝ ╚███╔╝ ██████╔╝██╔████╔██║
7+
* ██║ ██║██╔══██╗ ██╔██╗ ██╔═══╝ ██║╚██╔╝██║
8+
* ███████╗██║██████╔╝██╔╝ ██╗██║ ██║ ╚═╝ ██║
9+
* ╚══════╝╚═╝╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝ ╚═╝
10+
*/
11+
12+
13+
$path = ARCH_PATH . $lib->name . '-' . $lib->version . '\\';
14+
$xpmlog = LOG . 'libxpm.log';
15+
16+
17+
// Verify if libxpm is installed
18+
if (is_dir($path) && is_file($path . 'windows\builds\x64\Static Release\libxpm_a.lib') && is_file(DEPS_PATH . 'lib\libxpm_a.lib')) {
19+
draw_status($lib->name . '-' . $lib->version, "installed", Green);
20+
return;
21+
}
22+
23+
24+
// Download and unzip libxpm
25+
$tmpfile = TMP.pathinfo($lib->download_url, PATHINFO_BASENAME);
26+
if(!download_file($lib->download_url, $tmpfile, pathinfo($tmpfile, PATHINFO_BASENAME))) exit_error();
27+
if(!$firstdir = zip_first_dir($tmpfile)) exit_error("Invalid zip archive");
28+
if(!unzip($tmpfile, ARCH_PATH)) exit_error();
29+
if(!rename_wait(ARCH_PATH . $firstdir, $path)) exit_error("Can't rename library path");
30+
if(!unzip(__DIR__ . '\libxpm-msvc.zip', $path)) exit_error("Can't unzip msvc project");
31+
32+
33+
// Fix X11 version
34+
list($major, $minor, $revision) = explode('.', $lib->version);
35+
$contents = file_get_contents($path . 'include\X11\xpm.h');
36+
$contents = preg_replace('/#define XpmFormat\s+[0-9a-f]+/i', '#define XpmFormat ' . $major, $contents);
37+
$contents = preg_replace('/#define XpmVersion\s+[0-9a-f]+/i', '#define XpmVersion ' . $minor, $contents);
38+
$contents = preg_replace('/#define XpmRevision\s+[0-9a-f]+/i', '#define XpmRevision ' . $revision, $contents);
39+
file_put_contents($path . 'include\X11\xpm.h', $contents);
40+
41+
42+
// Compile static libxpm
43+
$label = "Compile " . $lib->name . '-' . $lib->version;
44+
draw_line($label, "running", Yellow);
45+
$bat = '@echo off'.RN;
46+
$bat .= 'cd ' . escapeshellarg($path . 'windows\vs16').RN;
47+
$bat .= 'DEVENV libxpm.sln /rebuild "Static Release|x64"';
48+
$batfile = TMP . 'build_libxpm.bat';
49+
file_put_contents($batfile, $bat);
50+
$ret = shell_exec_vs16($batfile);
51+
file_put_contents($xpmlog, $ret);
52+
53+
54+
// Verify if the build works
55+
if(!is_file($path . 'windows\builds\x64\Static Release\libxpm_a.lib')) draw_status($label, "failed", Red, true, 'SEE: ' . $xpmlog);
56+
else draw_status($label, "complete", Green);
57+
58+
59+
// Download proto headers
60+
$protofile = TMP.pathinfo($lib->xorgproto, PATHINFO_BASENAME);
61+
if(!download_file($lib->xorgproto, $protofile, pathinfo($protofile, PATHINFO_BASENAME))) exit_error("Can't download proto headers");
62+
63+
64+
// Download libx11 headers
65+
$libx11file = TMP.pathinfo($lib->libx11, PATHINFO_BASENAME);
66+
if(!download_file($lib->libx11, $libx11file, pathinfo($libx11file, PATHINFO_BASENAME))) exit_error("Can't download proto headers");
67+
68+
69+
// Install libxpm
70+
$label = "Install " . $lib->name . '-' . $lib->version;
71+
draw_line($label, "running", Yellow);
72+
$builddir = $path . 'build\\';
73+
$files[$path . 'windows\builds\x64\Static Release\libxpm_a.lib'] = 'lib\libxpm_a.lib';
74+
$files[$path . 'include\X11\xpm.h'] = 'include\X11\xpm.h';
75+
if(!create_build($builddir, $files)) draw_status($label, "failed", Red, true);
76+
77+
78+
// Install proto headers
79+
$zip = new ZipArchive;
80+
if ($zip->open($protofile) !== TRUE) draw_status($label, "failed", Red, true, "Invalid proto headers archive");
81+
if(!$contents = $zip->getFromName('xorgproto-master/include/X11/keysym.h')) draw_status($label, "failed", Red, true, "Invalid proto headers archive");
82+
else file_put_contents($builddir . 'include\X11\keysym.h', $contents);
83+
if(!$contents = $zip->getFromName('xorgproto-master/include/X11/keysymdef.h')) draw_status($label, "failed", Red, true, "Invalid proto headers archive");
84+
else file_put_contents($builddir . 'include\X11\keysymdef.h', $contents);
85+
if(!$contents = $zip->getFromName('xorgproto-master/include/X11/X.h')) draw_status($label, "failed", Red, true, "Invalid proto headers archive");
86+
else file_put_contents($builddir . 'include\X11\X.h', $contents);
87+
if(!$contents = $zip->getFromName('xorgproto-master/include/X11/Xfuncproto.h')) draw_status($label, "failed", Red, true, "Invalid proto headers archive");
88+
else file_put_contents($builddir . 'include\X11\Xfuncproto.h', $contents);
89+
if(!$contents = $zip->getFromName('xorgproto-master/include/X11/Xosdefs.h')) draw_status($label, "failed", Red, true, "Invalid proto headers archive");
90+
else file_put_contents($builddir . 'include\X11\Xosdefs.h', $contents);
91+
$zip->close();
92+
93+
94+
// Install libX11 headers
95+
$zip = new ZipArchive;
96+
if ($zip->open($libx11file) !== TRUE) draw_status($label, "failed", Red, true, "Invalid libX11 headers archive");
97+
if(!$contents = $zip->getFromName('libx11-master/include/X11/Xlib.h')) draw_status($label, "failed", Red, true, "Invalid libX11 headers archive");
98+
else file_put_contents($builddir . 'include\X11\Xlib.h', $contents);
99+
if(!$contents = $zip->getFromName('libx11-master/include/X11/Xutil.h')) draw_status($label, "failed", Red, true, "Invalid libX11 headers archive");
100+
else file_put_contents($builddir . 'include\X11\Xutil.h', $contents);
101+
$zip->close();
102+
103+
104+
// Finish install
105+
if(!install_deps($builddir)) draw_status($label, "failed", Red, true);
106+
else draw_status($label, "complete", Green);
107+
108+
delete_parent_deps($lib->name);

libraries/libxpm-msvc.zip

3.24 KB
Binary file not shown.

matrix.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1049,10 +1049,11 @@
10491049
},
10501050
{
10511051
"name": "libxpm",
1052-
"version": "3.5.12-8",
1053-
"download_url": "https://downloads.php.net/~windows/php-sdk/deps/vs16/x64/libxpm-3.5.12-8-vs16-x64.zip",
1054-
"install_script": "install_library.php",
1055-
"install_check": "lib\\libxpm_a.lib",
1052+
"version": "3.5.17",
1053+
"download_url": "https://gitlab.freedesktop.org/xorg/lib/libxpm/-/archive/libXpm-3.5.17/libxpm-libXpm-3.5.17.zip",
1054+
"xorgproto": "https://gitlab.freedesktop.org/xorg/proto/xorgproto/-/archive/master/xorgproto-master.zip",
1055+
"libx11": "https://gitlab.freedesktop.org/xorg/lib/libx11/-/archive/master/libx11-master.zip",
1056+
"install_script": "install_libxpm.php",
10561057
"mandatory": false,
10571058
"dependancies": []
10581059
},

0 commit comments

Comments
 (0)