Skip to content
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
12 changes: 10 additions & 2 deletions packages/php-wasm/compile/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,15 @@ bison2.7/dist/usr/local/bison/bin/bison: base-image
mkdir -p ./bison2.7/dist/usr/local/bison
docker build -f ./bison2.7/Dockerfile -t playground-php-wasm:bison2.7 . --progress=plain
docker cp $$(docker create playground-php-wasm:bison2.7):/usr/local/bison ./bison2.7/dist/usr/local

all: libz libzip libpng16 libxml2 libopenssl libsqlite3 libiconv libncurses libedit bison2.7

oniguruma: oniguruma/dist/root/lib/lib/libonig.a
oniguruma/dist/root/lib/lib/libonig.a: base-image
mkdir -p ./oniguruma/dist/root/lib/lib
docker build -f ./oniguruma/Dockerfile -t playground-php-wasm:oniguruma . --progress=plain
docker cp $$(docker create playground-php-wasm:oniguruma):/root/lib/lib ./oniguruma/dist/root/lib/
docker cp $$(docker create playground-php-wasm:oniguruma):/root/lib/include ./oniguruma/dist/root/lib

all: libz libzip libpng16 libxml2 libopenssl libsqlite3 libiconv libncurses libedit bison2.7 oniguruma
clean:
rm -rf ./libz/dist
rm -rf ./libzip/dist
Expand All @@ -93,3 +100,4 @@ clean:
rm -rf ./libncurses/dist
rm -rf ./libedit/dist
rm -rf ./bison2.7/dist
rm -rf ./oniguruma/dist
9 changes: 9 additions & 0 deletions packages/php-wasm/compile/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ const argParser = yargs(process.argv.slice(2))
choices: ['yes', 'no'],
description: 'Build with mbstring support',
},
WITH_MBREGEX: {
type: 'string',
choices: ['yes', 'no'],
description: 'Build with mbregex support',
},
WITH_CLI_SAPI: {
type: 'string',
choices: ['yes', 'no'],
Expand Down Expand Up @@ -117,6 +122,7 @@ const platformDefaults = {
WITH_LIBXML: 'yes',
WITH_LIBPNG: 'yes',
WITH_MBSTRING: 'yes',
WITH_MBREGEX: 'yes',
WITH_OPENSSL: 'yes',
},
node: {
Expand All @@ -125,6 +131,7 @@ const platformDefaults = {
WITH_LIBPNG: 'yes',
WITH_ICONV: 'yes',
WITH_MBSTRING: 'yes',
WITH_MBREGEX: 'yes',
WITH_CLI_SAPI: 'yes',
WITH_OPENSSL: 'yes',
WITH_NODEFS: 'yes',
Expand Down Expand Up @@ -184,6 +191,8 @@ await asyncSpawn(
'--build-arg',
getArg('WITH_MBSTRING'),
'--build-arg',
getArg('WITH_MBREGEX'),
'--build-arg',
getArg('WITH_CLI_SAPI'),
'--build-arg',
getArg('WITH_OPENSSL'),
Expand Down
22 changes: 22 additions & 0 deletions packages/php-wasm/compile/oniguruma/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
FROM playground-php-wasm:base

RUN mkdir -p /root/lib/include /root/lib/lib

RUN git clone https://github.com/kkos/oniguruma.git

RUN cd oniguruma && \
source /root/emsdk/emsdk_env.sh && \
autoreconf -vfi && \
CPPFLAGS="-I/root/lib/include " \
LDFLAGS="-L/root/lib/lib " \
emconfigure ./configure --prefix=/root/lib/ ;

RUN cd oniguruma && \
source /root/emsdk/emsdk_env.sh && \
EMCC_SKIP="-lz" EMCC_FLAGS=" -sSIDE_MODULE " emmake make;

RUN cd oniguruma && \
source /root/emsdk/emsdk_env.sh && \
emmake make install

RUN ls -r /root/lib
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
#ifndef ONIGGNU_H
#define ONIGGNU_H
/**********************************************************************
oniggnu.h - Oniguruma (regular expression library)
**********************************************************************/
/*-
* Copyright (c) 2002-2019 K.Kosako
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/

#include "oniguruma.h"

#ifdef __cplusplus
extern "C" {
#endif

enum {
RE_MBCTYPE_ASCII = 0,
RE_MBCTYPE_EUC = 1,
RE_MBCTYPE_SJIS = 2,
RE_MBCTYPE_UTF8 = 3
};

/* GNU regex options */
#ifndef RE_NREGS
#define RE_NREGS ONIG_NREGION
#endif

#define RE_OPTION_IGNORECASE ONIG_OPTION_IGNORECASE
#define RE_OPTION_EXTENDED ONIG_OPTION_EXTEND
#define RE_OPTION_MULTILINE ONIG_OPTION_MULTILINE
#define RE_OPTION_SINGLELINE ONIG_OPTION_SINGLELINE
#define RE_OPTION_LONGEST ONIG_OPTION_FIND_LONGEST
#define RE_OPTION_POSIXLINE (RE_OPTION_MULTILINE|RE_OPTION_SINGLELINE)
#define RE_OPTION_FIND_NOT_EMPTY ONIG_OPTION_FIND_NOT_EMPTY
#define RE_OPTION_NEGATE_SINGLELINE ONIG_OPTION_NEGATE_SINGLELINE
#define RE_OPTION_DONT_CAPTURE_GROUP ONIG_OPTION_DONT_CAPTURE_GROUP
#define RE_OPTION_CAPTURE_GROUP ONIG_OPTION_CAPTURE_GROUP


ONIG_EXTERN
void re_mbcinit P_((int));
ONIG_EXTERN
int re_compile_pattern P_((const char*, int, struct re_pattern_buffer*, char* err_buf));
ONIG_EXTERN
int re_recompile_pattern P_((const char*, int, struct re_pattern_buffer*, char* err_buf));
ONIG_EXTERN
void re_free_pattern P_((struct re_pattern_buffer*));
ONIG_EXTERN
int re_adjust_startpos P_((struct re_pattern_buffer*, const char*, int, int, int));
ONIG_EXTERN
int re_search P_((struct re_pattern_buffer*, const char*, int, int, int, struct re_registers*));
ONIG_EXTERN
int re_match P_((struct re_pattern_buffer*, const char *, int, int, struct re_registers*));
ONIG_EXTERN
void re_set_casetable P_((const char*));
ONIG_EXTERN
void re_free_registers P_((struct re_registers*));
ONIG_EXTERN
int re_alloc_pattern P_((struct re_pattern_buffer**)); /* added */

#ifdef __cplusplus
}
#endif

#endif /* ONIGGNU_H */
Loading