com web/rmtools: Implement move all dep dlls into package: data/config/pecl/libs.ini include/PeclExt.php
| From: | Anatol Belski | Date: | Wed, 21 Feb 2018 17:47:05 +0000 |
| Subject: | com web/rmtools: Implement move all dep dlls into package: data/config/pecl/libs.ini include/PeclExt.php | ||
| Groups: | php.webmaster | ||
| Request: | Send a blank email to php-webmaster+get-26763@lists.php.net to get a copy of this message | ||
Commit: f2e9b996640c0c5cc5105c5ba05f814469b30c9a
Author: Anatol Belski <ab@php.net> Wed, 21 Feb 2018 18:47:05 +0100
Parents: cb2e95f1b1c591861da283fc215f22bd62aae469
Branches: master
Link: http://git.php.net/?p=web/rmtools.git;a=commitdiff;h=f2e9b996640c0c5cc5105c5ba05f814469b30c9a
Log:
Implement move all dep dlls into package
Changed paths:
M data/config/pecl/libs.ini
M include/PeclExt.php
Diff:
diff --git a/data/config/pecl/libs.ini b/data/config/pecl/libs.ini
index 11f94f5..fb2c892 100644
--- a/data/config/pecl/libs..ini
+++ b/data/config/pecl/libs.ini
@@ -4,12 +4,17 @@
; expand_include= Whether subdirs in the includes of this lib have to be added to the path.
; Usually no header clashing happens, so if not set, default is true. Set
; explicitly to zero if you don't want it.
+; copy_all_dep_dll - Copy all dlls from libs configured, not just those that were linked.
+; Useful for libs like ImageMagic, that have loadable modules which
+; wouldn't be recognized by deplister otherwise.
[GraphicsMagick]
expand_include=1
+copy_all_dep_dll=1
[ImageMagick]
expand_include=1
+copy_all_dep_dll=1
[libavro]
expand_include=0
diff --git a/include/PeclExt.php b/include/PeclExt.php
index 6fcbf38..5f7f746 100644
--- a/include/PeclExt.php
+++ b/include/PeclExt.php
@@ -723,7 +723,7 @@ if (!function_exists('rmtools\combinations')) {
$ret
);
- if(file_exists($look_for)) {
+ if(file_exists($look_for) && !file_exists($dll_file)) {
if (!copy($look_for, $dll_file)) {
throw new \Exception("The dependency dll '$dll_name' "
. "was found but couldn't be copied into '$target'");
@@ -739,7 +739,7 @@ if (!function_exists('rmtools\combinations')) {
. DIRECTORY_SEPARATOR . $pdb_name;
- if(file_exists($look_for)) {
+ if(file_exists($look_for) && !file_exists($pdb_file)) {
if (!copy($look_for, $pdb_file)) {
throw new \Exception("The dependency pdb '$dll_name' "
. "was found but couldn't be copied into '$target'");
@@ -813,6 +813,62 @@ if (!function_exists('rmtools\combinations')) {
throw new \Exception($msg);
}
+ /* Look if we have to package all the dep DLLs. */
+ $config = $this->getPackageConfig();
+ var_dump($config);
+ if ($config && isset($config["libs"]) &&
is_array($config["libs"])) {
+ $deps_path = $this->build->branch->config->getPeclDepsBase();
+ foreach($config['libs'] as $lib) {
+ if (!$lib) {
+ continue;
+ }
+
+ $lib_conf = $this->getLibraryConfig($lib);
+ var_dump($lib_conf);
+ if (!isset($lib_conf["copy_all_dep_dll"]) ||
!$lib_conf["copy_all_dep_dll"]) {
+ continue;
+ }
+
+ $bin_path = $deps_path . DIRECTORY_SEPARATOR . $lib . DIRECTORY_SEPARATOR . "bin";
+ var_dump($bin_path);
+ if (!is_dir($bin_path)) {
+ continue;
+ }
+
+ $dep_dll = glob($bin_path . DIRECTORY_SEPARATOR . "*.dll");
+ var_dump($dep_dll);
+ foreach ($dep_dll as $base_dll_file) {
+ $dll_file = $target . DIRECTORY_SEPARATOR . basename($base_dll_file);
+ if (!file_exists($dll_file)) {
+ if (!copy($base_dll_file, $dll_file)) {
+ throw new \Exception("Couldn't copy '$base_dll_file' into
'$target'");
+ }
+ }
+ $files_to_zip[] = $dll_file;
+
+ $base_pdb_file = dirname($base_dll_file) . DIRECTORY_SEPARATOR . basename($base_dll_file,
".dll") . ".pdb";
+ $pdb_file = $target . DIRECTORY_SEPARATOR . basename($base_dll_file, ".dll") .
".pdb";
+ if (file_exists($base_pdb_file) && !file_exists($pdb_file)) {
+ if (!copy($base_pdb_file, $pdb_file)) {
+ throw new \Exception("Couldn't copy '$base_pdb_file' into
'$target'");
+ }
+ $files_to_zip[] = $pdb_file;
+ }
+
+ $files_to_zip = array_merge($this->prepareAllDepDlls($base_dll_file, $target),
$files_to_zip);
+ }
+
+ $dep_pdb = glob($bin_path . DIRECTORY_SEPARATOR . "*.pdb");
+ foreach ($dep_pdb as $base_pdb_file) {
+ $pdb_file = $target . DIRECTORY_SEPARATOR . basename($base_pdb_file);
+ if (!copy($base_pdb_file, $pdb_file)) {
+ throw new \Exception("Couldn't copy '$base_pdb_file' into
'$target'");
+ }
+ }
+ }
+ }
+ var_dump($files_to_zip);
+
/* care about extension license */
/* The ext license will be copied based on the info from package.xml, but let these lines stay */
$files_to_zip = array_merge(