forked from brefphp/extra-php-extensions
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request brefphp#567 from semsphy/master
Added h3 extension layer
- Loading branch information
Showing
4 changed files
with
60 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
ARG PHP_VERSION | ||
ARG BREF_VERSION | ||
FROM bref/build-php-$PHP_VERSION:$BREF_VERSION AS ext | ||
ARG PHP_VERSION | ||
|
||
# Prepare environment | ||
ENV H3_BUILD_DIR=${BUILD_DIR}/h3 | ||
RUN mkdir -p ${H3_BUILD_DIR} | ||
|
||
# Compile h3 | ||
WORKDIR ${H3_BUILD_DIR} | ||
RUN git clone https://github.com/uber/h3.git && \ | ||
cd h3 && \ | ||
git checkout v3.7.2 && \ | ||
cmake -DBUILD_SHARED_LIBS=ON . && \ | ||
make -j "$(nproc)" && \ | ||
make install | ||
|
||
# Compile the php h3 extension | ||
WORKDIR ${H3_BUILD_DIR}/h3-php | ||
RUN curl -L https://github.com/abler98/h3-php/archive/refs/tags/v1.0.0.tar.gz -o h3.tar.gz && \ | ||
tar xzf h3.tar.gz && \ | ||
cd h3-php-1.0.0 && \ | ||
phpize && \ | ||
./configure --with-h3 && \ | ||
make && \ | ||
make install | ||
|
||
RUN cp `php-config --extension-dir`/h3.so /tmp/h3.so | ||
RUN strip --strip-debug /tmp/h3.so | ||
RUN echo 'extension=h3.so' > /tmp/ext.ini | ||
|
||
RUN php /bref/lib-copy/copy-dependencies.php /tmp/h3.so /tmp/extension-libs | ||
|
||
# Build the final image with just the files we need | ||
FROM scratch | ||
|
||
# Copy things we installed to the final image | ||
COPY --from=ext /tmp/h3.so /opt/bref/extensions/h3.so | ||
COPY --from=ext /tmp/ext.ini /opt/bref/etc/php/conf.d/ext-h3.ini | ||
COPY --from=ext /tmp/extension-libs /opt/lib |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"php": [ | ||
"80", | ||
"81", | ||
"82", | ||
"83" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
|
||
if (!class_exists($class = \H3\H3Index::class)) { | ||
echo sprintf('FAIL: Class "%s" does not exist.', $class).PHP_EOL; | ||
exit(1); | ||
} | ||
|
||
|
||
exit(0); |