Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 0
start making this into a php extension#160
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
base:v2
Are you sure you want to change the base?
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
f3fd052bd782cc091c9657e3f8f9e650e8379783284db4fb73a0475ccd054a7b22b15af842a744e25be37ea3a03e88c56bdc0a5f7298352af1790b10d9fc4461bd04dFile filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,17 +1,31 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| TARGET := dphp-linux-* | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| BIN_PATH := ../bin | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| DOCKER_IMAGE := builder | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| DOCKER_TARGET := cli-base-alpine | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| BUILD_PATH := /go/src/app/cli/dist | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| DEBUG ?= 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ${BIN_PATH}/${TARGET}: cli.go */* go.mod build.sh build-php.sh ../Dockerfile | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| mkdir -p ${BIN_PATH} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| cd .. && docker buildx build --pull --load --target ${DOCKER_TARGET} -t ${DOCKER_IMAGE} . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| docker create --name ${DOCKER_IMAGE} ${DOCKER_IMAGE} || ( docker rm -f ${DOCKER_IMAGE} && false ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| docker cp ${DOCKER_IMAGE}:${BUILD_PATH}/dphp ${BIN_PATH}/ || ( docker rm -f ${DOCKER_IMAGE} && false ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| docker rm -f ${DOCKER_IMAGE} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| upx -9 --force-pie ../bin/dphp-* | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| PHP_INCLUDES := $(shell php-config --includes) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| PHP_LDFLAGS := $(shell php-config --ldflags) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| PHP_LIBS := $(shell php-config --libs) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ../dist: ${BIN_PATH}/${TARGET} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| docker create --name builder builder | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| docker cp ${DOCKER_IMAGE}:${BUILD_PATH} ../dist | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ifeq ($(DEBUG),1) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| XCADDY_FLAGS := -gcflags='all=-N -l' -tags=nobadger,nomysql,nopgx,nodphp,nobrotli | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| XCADDY_FLAGS := -ldflags='-w -s' -tags=nobadger,nomysql,nopgx,nodphp,nobrotli | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| endif | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| LOCAL_MODULE := /home/withinboredom/code/durable-php/cli | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| GEN_STUB := /home/withinboredom/code/php-src/build/gen_stub.php | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| LOCAL_FRANKENPHP_CADDY := /home/withinboredom/code/frankenphp/caddy | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| LOCAL_FRANKENPHP := /home/withinboredom/code/frankenphp | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Targets | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| frankenphp: ext/build/ext.go ext/build/ext_arginfo.h | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| CGO_ENABLED=1 \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| XCADDY_GO_BUILD_FLAGS="$(XCADDY_FLAGS)" \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| CGO_CFLAGS="$(PHP_INCLUDES)" \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| CGO_LDFLAGS="$(PHP_LDFLAGS) $(PHP_LIBS)" \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| xcaddy build \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| --output frankenphp \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| --with github.com/dunglas/frankenphp/caddy=$(LOCAL_FRANKENPHP_CADDY) \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| --with github.com/dunglas/frankenphp=$(LOCAL_FRANKENPHP) \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| --with github.com/bottledcode/durable-php/cli=$(LOCAL_MODULE) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Comment on lines
+19
to
+28
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Add phony targets and improve build organization The Makefile is missing standard phony targets and could benefit from better organization. Apply this diff to add missing phony targets and improve structure: +.PHONY: all clean test frankenphp++all: frankenphp++clean:+ rm -f frankenphp+ rm -f ext/build/ext_arginfo.h++test:+ @echo "No tests defined"+
# Targets
frankenphp: ext/build/ext.go ext/build/ext_arginfo.h📝 Committable suggestion
Suggested change
🧰 Tools🪛 checkmake (0.2.2)[warning] 19-19: Target body for "frankenphp" exceeds allowed length of 5 (9). (maxbodylength) 🤖 Prompt for AI Agents | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ext/build/ext_arginfo.h: ext/build/ext.stub.php | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $(GEN_STUB) ext/build/ext.stub.php ext/build | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| //go:build nodphp | ||
| package cli | ||
| import _ "github.com/bottledcode/durable-php/cli/ext/build" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| # ext Extension | ||
| Auto-generated PHP extension from Go code. | ||
| ## Functions | ||
| ### emit_event | ||
| ```php | ||
| emit_event(?array $userContext, array $event, string $from): int | ||
| ``` | ||
| **Parameters:** | ||
| - `userContext` (array) (nullable) | ||
| - `event` (array) | ||
| - `from` (string) | ||
| **Returns:** int | ||
| ## Classes | ||
| ### Worker | ||
| **Properties:** | ||
| - `kind`: mixed | ||
| - `started`: bool | ||
| - `consumer`: mixed (nullable) | ||
| - `activeId`: mixed (nullable) | ||
| - `state`: mixed (nullable) | ||
| - `pendingEvents`: array | ||
| - `authContext`: array | ||
| - `currentCtx`: mixed | ||
| - `currentMsg`: mixed | ||
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
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.
Remove hardcoded absolute paths for portability
The hardcoded paths will break when run on different machines or environments.
Use relative paths or environment variables instead:
Also applies to: 22-22
🤖 Prompt for AI Agents