Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use git submodule for library sources #16

Merged
merged 6 commits into from
Dec 3, 2024

Conversation

remicollet
Copy link
Contributor

To simply bundled library management, as explained in #7

@remicollet
Copy link
Contributor Author

remicollet commented Dec 2, 2024

@cmb69 your help welcome for needed change in config.w32 for this one (and perhaps CI)

P.S. CI is now green for linux

@cmb69
Copy link
Contributor

cmb69 commented Dec 2, 2024

We're hitting php/php-src#16843 now (md4c.c and libmd4c/src/md4c.c). To avoid that (fix is unlikely to land for stable PHP versions), might be best to rename md4c.c to php_md4c.c or something. Then a minimal solution for Windows would be:

 config.w32           | 9 ++++++++-
 md4c.c => php_md4c.c | 0
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/config.w32 b/config.w32
index 01b0921..851f590 100644
--- a/config.w32
+++ b/config.w32
@@ -1,5 +1,12 @@
 ARG_ENABLE('md4c', 'Enable the md4c extension', 'no');
 
 if (PHP_MD4C != 'no') {
-    EXTENSION('md4c', 'md4c.c');
+    EXTENSION('md4c', 'php_md4c.c');
+    ADD_SOURCES(configure_module_dirname + "/libmd4c/src", "\
+        entity.c \
+        md4c.c \
+        md4c-html.c",
+        "md4c"
+    );
+    CHECK_HEADER_ADD_INCLUDE("md4c-html.h", "CFLAGS_MD4C", "libmd4c/src/");
 }
diff --git a/md4c.c b/php_md4c.c
similarity index 100%
rename from md4c.c
rename to php_md4c.c

That should also be sufficient for CI.

That could also be extended to support --enable-system-libmd4c on Windows, although that would require https://github.com/winlibs to actually build this library, and given it is at 0.52, and not used so far by other packages, might not make much sense.

Also I wonder why there is an explicit --enable-system-libmd4c at all; could just run pkg-config, and if system lib is found use that; otherwise fall back to bundled.

@remicollet
Copy link
Contributor Author

@cmb69 thanks, applied

Also I wonder why there is an explicit --enable-system-libmd4c at all

Some user may prefer the bundled lib instead of system one, ex: when too old

I already think about a 3 states option (yes/no/auto), but IIRC from another ext, this was not a success, probably need to try again

@eklausme this PR is now broken because you create the submodule. Feel free to pick what is needed here which have everything needed for linux, windows and CI

@remicollet
Copy link
Contributor Author

Rebased, and CI is green on Windows and Linux (with bundled or system library)

@remicollet
Copy link
Contributor Author

@cmb69 see last commit which add "auto" mode

  • without option, use system library if available
  • --enable-system-libmd4c always use system library, fails if not available
  • --disable-system-libmd4c always use bundled library, ignore system

@eklausme eklausme merged commit 2b855c5 into eklausme:master Dec 3, 2024
15 checks passed
@remicollet remicollet deleted the issue-submodule branch December 3, 2024 09:57
@cmb69
Copy link
Contributor

cmb69 commented Dec 3, 2024

Thanks @remicollet, I think the option changes make sense.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants