Kévin Dunglas
|
25ed020036
|
feat: Windows support (#2119)
Closes #83 #880 #1286.
Working patch for Windows support.
Supports linking to the [official PHP release (TS
version)](https://www.php.net/downloads.php).
Includes some work from #1286 (thanks @TenHian!!)
This patch allows using Visual Studio to compile the cgo code. To do so,
it must be compiled with Go 1.26 (RC) with the following setup:
```powershell
winget install -e --id Microsoft.VisualStudio.2022.Community --override "--passive --wait --add Microsoft.VisualStudio.Workload.NativeDesktop --add Microsoft.VisualStudio.Component.VC.Llvm.Clang --includeRecommended"
winget install -e --id GoLang.Go
$env:PATH += ';C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\Llvm\bin'
cd c:\
gh repo clone microsoft/vcpkg
.\vcpkg\bootstrap-vcpkg.bat
.\vcpkg\vcpkg install pthreads brotli
# build watcher
Invoke-WebRequest -Uri "https://github.com/e-dant/watcher/releases/download/0.14.3/x86_64-pc-windows-msvc.tar" -OutFile "$env:TEMP\watcher.tar"
tar -xf "$env:TEMP\watcher.tar" -C C:\
Rename-Item -Path "C:\x86_64-pc-windows-msvc" -NewName "watcher-x86_64-pc-windows-msvc"
Remove-Item "$env:TEMP\watcher.tar"
# download php
Invoke-WebRequest -Uri "https://downloads.php.net/~windows/releases/archives/php-8.5.1-Win32-vs17-x64.zip" -OutFile "$env:TEMP\php.zip"
Expand-Archive -Path "$env:TEMP\php.zip" -DestinationPath "C:\"
Remove-Item "$env:TEMP\php.zip"
# download php development package
Invoke-WebRequest -Uri "https://downloads.php.net/~windows/releases/archives/php-devel-pack-8.5.1-Win32-vs17-x64.zip" -OutFile "$env:TEMP\php-devel.zip"
Expand-Archive -Path "$env:TEMP\php-devel.zip" -DestinationPath "C:\"
Remove-Item "$env:TEMP\php-devel.zip"
$env:GOTOOLCHAIN = 'go1.26rc1'
$env:CC = 'clang'
$env:CXX = 'clang++'
$env:CGO_CFLAGS = "-I$env:C:\vcpkg\installed\x64-windows\include -IC:\watcher-x86_64-pc-windows-msvc -IC:\php-8.5.1-devel-vs17-x64\include -IC:\php-8.5.1-devel-vs17-x64\include\main -IC:\php-8.5.1-devel-vs17-x64\include\TSRM -IC:\php-8.5.1-devel-vs17-x64\include\Zend -IC:\php-8.5.1-devel-vs17-x64\include\ext"
$env:CGO_LDFLAGS = '-LC:\vcpkg\installed\x64-windows\lib -lbrotlienc -LC:\watcher-x86_64-pc-windows-msvc -llibwatcher-c -LC:\php-8.5.1-Win32-vs17-x64 -LC:\php-8.5.1-devel-vs17-x64\lib -lphp8ts -lphp8embed'
# clone frankenphp and build
git clone -b windows https://github.com/php/frankenphp.git
cd frankenphp\caddy\frankenphp
go build -ldflags '-extldflags="-fuse-ld=lld"' -tags nowatcher,nobadger,nomysql,nopgx
# Tests
$env:PATH += ";$env:VCPKG_ROOT\installed\x64-windows\bin;C:\watcher-x86_64-pc-windows-msvc";C:\php-8.5.1-Win32-vs17-x64"
"opcache.enable=0`r`nopcache.enable_cli=0" | Out-File -Encoding ascii php.ini
$env:PHPRC = Get-Location
go test -ldflags '-extldflags="-fuse-ld=lld"' -tags nowatcher,nobadger,nomysql,nopgx .
```
TODO:
- [x] Fix remaining skipped tests (scaling and watcher)
- [x] Test if the watcher mode works as expected
- [x] Automate the build with GitHub Actions
---------
Signed-off-by: Marc <m@pyc.ac>
Co-authored-by: Kévin Dunglas <kevin@dunglas.dev>
Co-authored-by: DubbleClick <m@pyc.ac>
|
2026-02-26 12:38:14 +01:00 |
|
Kévin Dunglas
|
8e1641b81c
|
ci: disable codespell linter (#2153)
|
2026-01-29 17:23:50 +01:00 |
|
Alexandre Daubois
|
7fca07ed67
|
feat(types): expose IsPacked to help dealing with hashmaps and lists in Go code
|
2025-12-15 15:35:21 +01:00 |
|
Alexandre Daubois
|
bb1c3678dc
|
feat(extgen): add support for callable in parameters (#1731)
|
2025-12-15 12:50:50 +01:00 |
|
Alexander Stecher
|
11213fd1de
|
fix: returns a zend_array directly in types.go (#1894)
|
2025-12-12 22:55:58 +01:00 |
|
Kévin Dunglas
|
f7756717b5
|
feat: allow creating strongly typed slices and maps from PHP values with type utilities (#1933)
* feat: use generics in type functions for better type support
* various improvements
* better docs
* update docs
|
2025-10-21 11:20:54 +02:00 |
|
Kévin Dunglas
|
c42d287138
|
refactor: extension worker (#1910)
* refactor: extension worker
* feat: optional HTTP request
* allow passing unsafe.Pointer to the extension callback
* lint
* simplify
|
2025-10-09 14:10:09 +02:00 |
|
Kévin Dunglas
|
7754abcbd0
|
fix: PHPValue() and GoValue() types (#1879)
* fix: PHPValue() return type
* fix: GoValue() argument type
|
2025-09-15 17:04:06 +02:00 |
|
Kévin Dunglas
|
52a0be5728
|
feat(ext): expose GoValue() and PHPValue() functions (#1877)
* feat(ext): expose a GoValue function
* GoValue()
|
2025-09-15 16:25:11 +02:00 |
|
Alexander Stecher
|
d540727369
|
feat:(extgen) make Go arrays more consistent with PHP arrays (#1800)
* Makes go arrays more consistent with PHP arrays.
* NewAssociativeArray.
* linting
* go linting
* Exposes all primitive types.
* Removes pointer alias
* linting
* Optimizes hash update.
* Fixes extgen tests.
* Moves file to tests.
* Fixes suggested by @dunglas.
* Replaces 'interface{}' with 'any'.
* Panics on wrong zval.
* interface improvements as suggested by @dunglas.
* Adjusts docs.
* Adjusts docs.
* Removes PackedArray alias and adjusts docs.
* Updates docs.
|
2025-08-25 16:24:15 +02:00 |
|
Alexandre Daubois
|
1d0169d321
|
fix(types): better zval handling to avoid leaks with arrays (#1780)
|
2025-08-04 19:00:13 +02:00 |
|
Alexandre Daubois
|
8df41236d9
|
feat(extgen): add support for arrays as parameters and return types (#1724)
* feat(extgen): add support for arrays as parameters and return types
* cs
---------
Co-authored-by: Kévin Dunglas <kevin@dunglas.fr>
|
2025-07-16 12:05:29 +02:00 |
|
Kévin Dunglas
|
abfd893d88
|
feat: FrankenPHP extensions (#1651)
* feat: add helpers to create PHP extensions (#1644)
* feat: add helpers to create PHP extensions
* cs
* feat: GoString
* test
* add test for RegisterExtension
* cs
* optimize includes
* fix
* feat(extensions): add the PHP extension generator (#1649)
* feat(extensions): add the PHP extension generator
* unexport many types
* unexport more symbols
* cleanup some tests
* unexport more symbols
* fix
* revert types files
* revert
* add better validation and fix templates
* remove GoStringCopy
* small fixes
---------
Co-authored-by: Kévin Dunglas <kevin@dunglas.fr>
* try to fix tests
* fix CS
* try some workarounds
* try some workarounds
* ingore TestRegisterExtension
* exclude cgo tests in Docker images
* fix
* workaround...
* race detector
* simplify tests and code
* make linter happy
* feat(gofile): use templates to generate the Go file (#1666)
---------
Co-authored-by: Alexandre Daubois <2144837+alexandre-daubois@users.noreply.github.com>
|
2025-06-25 10:18:22 +02:00 |
|