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
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 21 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,36 @@ jobs:
strategy:
matrix:
version: ['8.0', '8.1', '8.2', '8.3', '8.4']
library:
- ''
- 'system'
runs-on: ubuntu-latest
steps:
- name: Checkout md4c
uses: actions/checkout@v4
- name: Checkout submodules
run: |
git submodule update --init --recursive
if: ${{ ! matrix.library }}
- name: Install library
run: |
sudo apt-get install -y "automake" "libtool" "libmd4c-dev" "libmd4c-html0-dev"
if: ${{ matrix.library }}
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{matrix.version}}
tools: phpize
- name: phpize
run: phpize
- name: configure
run: ./configure --enable-md4c
- name: configure with bundled library
run: |
./configure --enable-md4c
if: ${{ ! matrix.library }}
- name: configure with library
run: |
./configure --enable-md4c --enable-system-libmd4c
if: ${{ matrix.library }}
- name: make
run: make
- name: test
Expand All @@ -36,6 +53,8 @@ jobs:
steps:
- name: Checkout md4c
uses: actions/checkout@v4
- name: Checkout submodules
run: git submodule update --init --recursive
- name: Setup PHP
id: setup-php
uses: php/[email protected]
Expand Down
4 changes: 2 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "md4c"]
path = md4c
[submodule "libmd4c"]
path = libmd4c
url = https://github.com/mity/md4c
31 changes: 27 additions & 4 deletions config.m4
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,44 @@ PHP_ARG_ENABLE(md4c, [whether to enable MD4C support],
[AS_HELP_STRING([--enable-md4c], [Enable MD4C support])], [yes], [yes])

PHP_ARG_ENABLE(system-libmd4c, [whether to enable system libmd4c library],
[AS_HELP_STRING([--enable-system-md4c], [Enable system libmd4c])], [no], [no])
[AS_HELP_STRING([--disable-system-libmd4c], [Disable system libmd4c])], [auto], [no])

if test "$PHP_MD4C" != "no"; then
if test "$PHP_SYSTEM_LIBMD4C" = "yes"; then
AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
AC_PATH_PROG(PKG_CONFIG, pkg-config, no)

dnl by default (auto mode) use system library if available
if test "$PHP_SYSTEM_LIBMD4C" = "auto"; then
AC_MSG_CHECKING([libmd4c])
if pkg-config --exists md4c-html; then
AC_MSG_RESULT([use available system library])
PHP_SYSTEM_LIBMD4C="yes"
else
AC_MSG_RESULT([use bundled library])
fi
fi

if test "$PHP_SYSTEM_LIBMD4C" = "yes"; then
dnl use system library
PKG_CHECK_MODULES([LIBMD4C_HTML], [md4c-html])
PHP_EVAL_INCLINE($LIBMD4C_HTML_CFLAGS)
PHP_EVAL_LIBLINE($LIBMD4C_HTML_LIBS, MD4C_SHARED_LIBADD)
AC_DEFINE([HAVE_LIBMD4C], 1, [With system libmd4c library])

LIBMD4C_VERSION=`$PKG_CONFIG md4c-html --modversion`
AC_DEFINE_UNQUOTED([PHP_LIBMD4C_VERSION], ["$LIBMD4C_VERSION"], [With system libmd4c library])

PHP_NEW_EXTENSION(md4c, php_md4c.c, $ext_shared)
else
dnl use bundled library
LIBMD4C_SOURCES="$EXT_SOURCES \
libmd4c/src/entity.c \
libmd4c/src/md4c.c \
libmd4c/src/md4c-html.c \
"
PHP_NEW_EXTENSION(md4c, php_md4c.c $LIBMD4C_SOURCES, $ext_shared)
PHP_ADD_INCLUDE([$ext_srcdir/libmd4c/src])
PHP_ADD_BUILD_DIR([$ext_builddir/libmd4c/src])
fi
PHP_SUBST(MD4C_SHARED_LIBADD)
AC_DEFINE(HAVE_MD4C, 1, [ ])
PHP_NEW_EXTENSION(md4c, md4c.c, $ext_shared)
fi
9 changes: 8 additions & 1 deletion config.w32
Original file line number Diff line number Diff line change
@@ -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/");
}
1 change: 1 addition & 0 deletions libmd4c
Submodule libmd4c added at 729e6b
1 change: 0 additions & 1 deletion md4c
Submodule md4c deleted from 481fbf
Loading
Loading