-
-
Notifications
You must be signed in to change notification settings - Fork 23
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
Generate includes from PHP source directly #52
Draft
iggyvolz
wants to merge
5
commits into
lisachenko:master
Choose a base branch
from
iggyvolz:generate-includes
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,85 @@ | ||
FROM php:8.1.0-zts-bullseye AS php-8-1-x64-zts-linux-build | ||
RUN apt update | ||
RUN apt install libffi-dev | ||
RUN docker-php-ext-install ffi | ||
RUN curl http://131.123.42.38/lmcrs/v1.0.0/srcml_1.0.0-1_ubuntu20.04.deb > srcml.deb | ||
RUN apt install -y ./srcml.deb | ||
COPY process.php . | ||
COPY symbols.txt . | ||
RUN php process.php linux | ||
FROM scratch AS php-8-1-x64-zts-linux | ||
COPY --from=php-8-1-x64-zts-linux-build /engine-8-1-x64-zts-linux.h / | ||
COPY --from=php-8-1-x64-zts-linux-build /constants-8-1-x64-zts-linux.php / | ||
|
||
FROM php:8.1.0-bullseye AS php-8-1-x64-nts-linux-build | ||
RUN apt update | ||
RUN apt install libffi-dev | ||
RUN docker-php-ext-install ffi | ||
RUN curl http://131.123.42.38/lmcrs/v1.0.0/srcml_1.0.0-1_ubuntu20.04.deb > srcml.deb | ||
RUN apt install -y ./srcml.deb | ||
COPY process.php . | ||
COPY symbols.txt . | ||
RUN php process.php linux | ||
FROM scratch AS php-8-1-x64-nts-linux | ||
COPY --from=php-8-1-x64-nts-linux-build /engine-8-1-x64-nts-linux.h / | ||
COPY --from=php-8-1-x64-nts-linux-build /constants-8-1-x64-nts-linux.php / | ||
|
||
FROM php:8.0.0-zts-buster AS php-8-0-x64-zts-linux-build | ||
RUN apt update | ||
RUN apt install libffi-dev | ||
RUN docker-php-ext-install ffi | ||
RUN curl http://131.123.42.38/lmcrs/v1.0.0/srcml_1.0.0-1_ubuntu19.04.deb > srcml.deb | ||
RUN apt install -y ./srcml.deb | ||
COPY process.php . | ||
COPY symbols.txt . | ||
RUN php process.php linux | ||
FROM scratch AS php-8-0-x64-zts-linux | ||
COPY --from=php-8-0-x64-zts-linux-build /engine-8-0-x64-zts-linux.h / | ||
COPY --from=php-8-0-x64-zts-linux-build /constants-8-0-x64-zts-linux.php / | ||
|
||
FROM php:8.0.0-buster AS php-8-0-x64-nts-linux-build | ||
RUN apt update | ||
RUN apt install libffi-dev | ||
RUN docker-php-ext-install ffi | ||
RUN curl http://131.123.42.38/lmcrs/v1.0.0/srcml_1.0.0-1_ubuntu19.04.deb > srcml.deb | ||
RUN apt install -y ./srcml.deb | ||
COPY process.php . | ||
COPY symbols.txt . | ||
RUN php process.php linux | ||
FROM scratch AS php-8-0-x64-nts-linux | ||
COPY --from=php-8-0-x64-nts-linux-build /engine-8-0-x64-nts-linux.h / | ||
COPY --from=php-8-0-x64-nts-linux-build /constants-8-0-x64-nts-linux.php / | ||
|
||
FROM php:7.4.0-zts-buster AS php-7-4-x64-zts-linux-build | ||
RUN apt update | ||
RUN apt install libffi-dev | ||
RUN docker-php-ext-install ffi | ||
RUN curl http://131.123.42.38/lmcrs/v1.0.0/srcml_1.0.0-1_ubuntu19.04.deb > srcml.deb | ||
RUN apt install -y ./srcml.deb | ||
COPY process.php . | ||
COPY symbols.txt . | ||
RUN php process.php linux | ||
FROM scratch AS php-7-4-x64-zts-linux | ||
COPY --from=php-7-4-x64-zts-linux-build /engine-7-4-x64-zts-linux.h / | ||
COPY --from=php-7-4-x64-zts-linux-build /constants-7-4-x64-zts-linux.php / | ||
|
||
FROM php:7.4.0-buster AS php-7-4-x64-nts-linux-build | ||
RUN apt update | ||
RUN apt install libffi-dev | ||
RUN docker-php-ext-install ffi | ||
RUN curl http://131.123.42.38/lmcrs/v1.0.0/srcml_1.0.0-1_ubuntu19.04.deb > srcml.deb | ||
RUN apt install -y ./srcml.deb | ||
COPY process.php . | ||
COPY symbols.txt . | ||
RUN php process.php linux | ||
FROM scratch AS php-7-4-x64-nts-linux | ||
COPY --from=php-7-4-x64-nts-linux-build /engine-7-4-x64-nts-linux.h / | ||
COPY --from=php-7-4-x64-nts-linux-build /constants-7-4-x64-nts-linux.php / | ||
|
||
FROM scratch | ||
COPY --from=php-8-1-x64-zts-linux /* / | ||
COPY --from=php-8-1-x64-nts-linux /* / | ||
COPY --from=php-8-0-x64-zts-linux /* / | ||
COPY --from=php-8-0-x64-nts-linux /* / | ||
COPY --from=php-7-4-x64-zts-linux /* / | ||
COPY --from=php-7-4-x64-nts-linux /* / |
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,27 @@ | ||
<?php | ||
$top = ""; | ||
$bottom = "FROM scratch\n"; | ||
foreach([[8, 1, "bullseye", "srcml_1.0.0-1_ubuntu20.04.deb"], [8, 0, "buster", "srcml_1.0.0-1_ubuntu19.04.deb"], [7, 4, "buster", "srcml_1.0.0-1_ubuntu19.04.deb"]] as [$major, $minor, $distro, $srcmlDeb]) | ||
foreach(["x64"] as $arch) | ||
foreach([["zts", "-zts"], ["nts", ""]] as [$threadSafety, $ts]) | ||
foreach(["linux"] as $os) { | ||
$top .= <<<DOCKERFILE | ||
FROM php:$major.$minor.0$ts-$distro AS php-$major-$minor-$arch-$threadSafety-$os-build | ||
RUN apt update | ||
RUN apt install libffi-dev | ||
RUN docker-php-ext-install ffi | ||
RUN curl http://131.123.42.38/lmcrs/v1.0.0/$srcmlDeb > srcml.deb | ||
RUN apt install -y ./srcml.deb | ||
COPY process.php . | ||
COPY symbols.txt . | ||
RUN php process.php $os | ||
FROM scratch AS php-$major-$minor-$arch-$threadSafety-$os | ||
COPY --from=php-$major-$minor-$arch-$threadSafety-$os-build /engine-$major-$minor-$arch-$threadSafety-$os.h / | ||
COPY --from=php-$major-$minor-$arch-$threadSafety-$os-build /constants-$major-$minor-$arch-$threadSafety-$os.php / | ||
|
||
|
||
DOCKERFILE; | ||
$bottom .= "COPY --from=php-$major-$minor-$arch-$threadSafety-$os /* /\n"; | ||
} | ||
|
||
echo "$top$bottom"; |
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,25 @@ | ||
To regenerate the dockerfile, run `php Dockerfile.php > Dockerfile` | ||
To regenerate headers, run: `docker buildx build . -o .` | ||
To generate headers without checking (useful for getting a copy of the header file to identify any errors), comment out the last line of process.php | ||
|
||
Symbols syntax: | ||
- `x`: export symbol x | ||
- `#x`: export definition x | ||
- `//...`: Comment | ||
|
||
Modifiers (after a symbol): | ||
- `zts` / `nts`: Only import symbol on thread-safe/non-thread-safe | ||
- `<x.y` / `>x.y` / `<=x.y` / `>=x.y` / `=x.y` / `!=x.y`: Only import symbol on a given PHP version | ||
|
||
To add a new symbol: | ||
- Check what PHP versions it's defined in and if it's in an `#ifdef` (specifically `ZTS`) and add modifiers as appropriate | ||
- Add to bottom of symbols.txt *unless* required by another symbol (in which case list it above) | ||
- Regenerate headers and ensure all builds pass | ||
- Commit updated headers | ||
|
||
To add a new PHP version: | ||
- Add to Dockerfile.php | ||
- Regenerate dockerfile | ||
- Regenerate headers | ||
- Add modifier for any removed symbols to exclude them | ||
- Add modifier for any newly required symbols (ex. members of common classes) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately the official srcML download link is HTTP - https://www.srcml.org/ - not an issue at runtime unless you're regenerating the headers but it's definitely a security issue.