Skip to content
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

Windows build t #867

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
087e445
windows build native php
jingjingxyk Jun 14, 2024
9490c6c
update build config
jingjingxyk Jun 15, 2024
8470eaf
show build native php result
jingjingxyk Jun 15, 2024
dff25a4
format markdown file
jingjingxyk Jun 15, 2024
726e5b5
merge code
jingjingxyk Nov 16, 2024
78586c0
Merge branch 'build_native_php' into windows-build-native-php
jingjingxyk Nov 20, 2024
95aa81e
update
jingjingxyk Nov 20, 2024
7e033db
Merge branch 'build_native_php' into windows-build-native-php
jingjingxyk Nov 22, 2024
1303158
merge code
jingjingxyk Nov 23, 2024
63e9982
update
jingjingxyk Nov 24, 2024
e7e6db2
Merge branch 'build_native_php' into windows-build-native-php
jingjingxyk Nov 24, 2024
ee36902
Merge branch 'windows-build-native-php' into windows-build-t
jingjingxyk Nov 24, 2024
4b82016
test
jingjingxyk Nov 24, 2024
2d1ad29
update
jingjingxyk Nov 25, 2024
9f05fd2
test
jingjingxyk Nov 26, 2024
7853bec
test
jingjingxyk Nov 26, 2024
74faed8
test
jingjingxyk Nov 26, 2024
eed55a1
test
jingjingxyk Nov 26, 2024
799061b
test
jingjingxyk Nov 26, 2024
b6cb32b
test
jingjingxyk Nov 26, 2024
6f7afd3
test
jingjingxyk Nov 26, 2024
5b6e617
test
jingjingxyk Nov 26, 2024
dea595f
test
jingjingxyk Nov 26, 2024
2c51b9d
test
jingjingxyk Nov 26, 2024
3edcb32
test
jingjingxyk Nov 26, 2024
b102e0e
test
jingjingxyk Nov 26, 2024
2ba18b3
test
jingjingxyk Nov 26, 2024
9303135
update
jingjingxyk Nov 27, 2024
6952644
update
jingjingxyk Nov 28, 2024
7480929
update
jingjingxyk Nov 28, 2024
22c8b72
update
jingjingxyk Nov 28, 2024
f2d8c9b
update
jingjingxyk Nov 28, 2024
b93aaf5
update
jingjingxyk Nov 29, 2024
e586093
update
jingjingxyk Nov 29, 2024
2e37b28
update
jingjingxyk Nov 29, 2024
2599661
update
jingjingxyk Nov 29, 2024
478a487
Merge branch 'build_native_php' into windows-build-t
jingjingxyk Dec 3, 2024
81c2035
Merge branch 'build_native_php' into windows-build-native-php
jingjingxyk Dec 3, 2024
b5af526
Merge branch 'windows-build-native-php' into windows-build-t
jingjingxyk Dec 3, 2024
7198232
update
jingjingxyk Dec 3, 2024
486d32a
update
jingjingxyk Dec 4, 2024
07004c0
Merge branch 'build_native_php' into windows-build-native-php
jingjingxyk Dec 5, 2024
44b8075
Merge branch 'windows-build-native-php' into windows-build-t
jingjingxyk Dec 5, 2024
26656f6
update
jingjingxyk Dec 5, 2024
36a216c
update
jingjingxyk Dec 6, 2024
d19451a
完善 windwos native build php
jingjingxyk Dec 15, 2024
0017c69
update
jingjingxyk Dec 15, 2024
cd9d00a
update
jingjingxyk Dec 15, 2024
56b3cc6
update
jingjingxyk Dec 15, 2024
ccc78d2
update
jingjingxyk Dec 15, 2024
be3c4b1
update
jingjingxyk Dec 15, 2024
c1e14e0
update
jingjingxyk Dec 15, 2024
67eafe0
update
jingjingxyk Dec 15, 2024
0ac52a0
update
jingjingxyk Dec 15, 2024
76ed91d
update
jingjingxyk Dec 15, 2024
34e3f5f
update
jingjingxyk Dec 15, 2024
253ed2d
update
jingjingxyk Dec 15, 2024
a8f4218
update
jingjingxyk Dec 15, 2024
0316230
Merge branch 'build_native_php' into windows-build-t
jingjingxyk Dec 15, 2024
8d56ff7
merge coee
jingjingxyk Dec 15, 2024
ad27029
merge coee
jingjingxyk Dec 15, 2024
98f0b80
merge coee
jingjingxyk Dec 15, 2024
81473d6
merge coee
jingjingxyk Dec 15, 2024
3d9721c
merge coee
jingjingxyk Dec 15, 2024
38f5e49
merge coee
jingjingxyk Dec 15, 2024
54e3f82
merge coee
jingjingxyk Dec 15, 2024
5793af8
merge coee
jingjingxyk Dec 15, 2024
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
2 changes: 1 addition & 1 deletion .github/workflows/auto-cache-pool-tarball.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:

jobs:
auto-cache-pool:
if: 1
if: 0
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/linux-aarch64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ env:

jobs:
linux-aarch64:
if: 1
if: 0
runs-on: ubuntu-latest
strategy:
matrix:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/linux-x86_64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ env:

jobs:
linux-x86_64:
if: 1
if: 0
runs-on: ubuntu-latest
strategy:
matrix:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/macos-aarch64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ env:

jobs:
macos-aarch64:
if: 1
if: 0
runs-on: macos-14
# macos-latest (macos-14) 变更了 CPU 架构,由 x86_64 变更为 arm64
# macos-14 CPU 架构 arm64
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/macos-x86_64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ env:

jobs:
macos-x86_64:
if: 1
if: 0
runs-on: macos-13
# macos-latest (macos-14) 变更了 CPU 架构,由 x86_64 变更为 arm64
# macos-14 CPU 架构 arm64
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/runner-os-readme.md
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
https://github.com/actions/runner-images/tree/main/images
https://github.com/actions/runner-images
2 changes: 1 addition & 1 deletion .github/workflows/windows-cygwin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ env:

jobs:
windows-cygwin:
if: 1
if: 0
runs-on: windows-latest
strategy:
matrix:
Expand Down
123 changes: 123 additions & 0 deletions .github/workflows/windows-native-vs2022.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
name: build-php-cli-windows-vs2022

on:
push:
pull_request:

env:
BUILD_PHP_VERSION: 8.2.13

jobs:
windows-native:
if: 1
runs-on: windows-2022
strategy:
matrix:
php-version:
# - "8.2.13"
# - "8.1.27"
- "8.3.11"

steps:
- uses: actions/checkout@v4
- uses: ilammy/msvc-dev-cmd@v1
with:
arch: amd64
vsversion:
- name: show environment info
run: |
git config --global core.autocrlf false
git config --global core.eol lf
git config --global core.ignorecase false
env
ipconfig
uname -a
pwd
ipconfig /all
# 显示逻辑cpu 个数
wmic cpu get NumberOfLogicalProcessors /value
# echo %NUMBER_OF_PROCESSORS%
Write-Output $env:NUMBER_OF_PROCESSORS
systeminfo
echo "BUILD_PHP_VERSION=${{ matrix.php-version }}" >> $Env:GITHUB_ENV

- name: prepare deps soft
shell: cmd
run: |
sapi\quickstart\windows\native-build\windows-init.bat

- name: Set Github ENV variables
run: |
$CURRENT_DIR = Get-Location
echo "PHP_SDK_ARCH=x64" >> $Env:GITHUB_ENV
echo "PHP_SDK_BIN_PATH=${CURRENT_DIR}\var\windows-build-deps\php-sdk-binary-tools\bin" >> $Env:GITHUB_ENV
echo "PHP_SDK_MSYS2_PATH=${CURRENT_DIR}\var\windows-build-deps\php-sdk-binary-tools\msys2\usr\bin" >> $Env:GITHUB_ENV
echo "PHP_SDK_OS_ARCH=x64" >> $Env:GITHUB_ENV
echo "PHP_SDK_PHP_CMD=${CURRENT_DIR}\var\windows-build-deps\php-sdk-binary-tools\bin\php\do_php.bat" >> $Env:GITHUB_ENV
echo "PHP_SDK_ROOT_PATH=${CURRENT_DIR}\var\windows-build-deps\php-sdk-binary-tools" >> $Env:GITHUB_ENV
echo "PHP_SDK_VC_DIR=C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC" >> $Env:GITHUB_ENV
echo "PHP_SDK_VC_TOOLSET_VER=$env:VCToolsVersion" >> $Env:GITHUB_ENV
echo "PHP_SDK_VS=vs17" >> $Env:GITHUB_ENV
echo "PHP_SDK_VS_NUM=17" >> $Env:GITHUB_ENV
echo "PHP_SDK_VS_SHELL_CMD=C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat amd64" >> $Env:GITHUB_ENV


$X_PATH = "${CURRENT_DIR}\var\windows-build-deps\php-sdk-binary-tools\bin;${CURRENT_DIR}\var\windows-build-deps\php-sdk-binary-tools\msys2\usr\bin;${CURRENT_DIR}\bin\runtime\nasm\;$env:PATH"
echo $X_PATH
echo "PATH=$X_PATH" >> $Env:GITHUB_ENV

- name: show deps soft
if: 1
run: |
$CURRENT_DIR = Get-Location
where perl
php -v
perl -v
nasm -v


- name: php prepare
shell: cmd
run: |
cd var\windows-build-deps\php-src\
.\buildconf.bat -f

- name: php config
shell: cmd
run: |
cd var\windows-build-deps\php-src\
configure.bat ^
--disable-all --disable-cgi --enable-cli ^
--enable-sockets --enable-ctype --enable-pdo --enable-phar ^
--enable-filter ^
--enable-xmlreader --enable-xmlwriter ^
--enable-tokenizer

- name: php build
shell: cmd
run: |
cd var\windows-build-deps\php-src\
where bison.exe
where re2c.exe
nmake /E

- name: Show Build Result
run: |
cd var\windows-build-deps\php-src\

.\x64\Release_TS\php.exe -v
.\x64\Release_TS\php.exe -m
dumpbin /DEPENDENTS ".\x64\Release_TS\php.exe"

- name: production artifacts
uses: actions/upload-artifact@v4
with:
name: php-cli-v${{ env.BUILD_PHP_VERSION }}-vs16-x64
retention-days: 90
path: "var\windows-build-deps\php-src\\x64\Release_TS\php.exe"

- name: gh release
uses: softprops/action-gh-release@v2
if: 0 && startsWith(github.ref, 'refs/tags/')
with:
files: "var\windows-build-deps\php-src\\x64\Release_TS\php.exe"
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"require": {
"marcj/topsort": "^2.0",
"ext-posix": "*",
"ext-curl": "*",
"ext-json": "*",
"ext-fileinfo": "*",
"ext-zip": "*",
"phpunit/phpunit": "^9.6",
"nikic/php-parser": "^5.0"
},
Expand Down
37 changes: 24 additions & 13 deletions prepare.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,25 @@
}


$osType = $p->getOsType();
# clean
# clean old make.sh
$p->cleanFile(__DIR__ . '/make.sh');
$p->cleanFile(__DIR__ . '/make-install-deps.sh');
$p->cleanFile(__DIR__ . '/make-env.sh');
$p->cleanFile(__DIR__ . '/make-export-variables.sh');
$p->cleanFile(__DIR__ . '/make-download-box.sh');
$p->cleanFile(__DIR__ . '/cppflags.log');
$p->cleanFile(__DIR__ . '/ldflags.log');
$p->cleanFile(__DIR__ . '/libs.log');
$p->cleanFile(__DIR__ . '/configure.backup');

if ($osType == 'win') {

} else {

# clean old make.sh
$p->cleanFile(__DIR__ . '/make.sh');
$p->cleanFile(__DIR__ . '/make-install-deps.sh');
$p->cleanFile(__DIR__ . '/make-env.sh');
$p->cleanFile(__DIR__ . '/make-export-variables.sh');
$p->cleanFile(__DIR__ . '/make-download-box.sh');
$p->cleanFile(__DIR__ . '/cppflags.log');
$p->cleanFile(__DIR__ . '/ldflags.log');
$p->cleanFile(__DIR__ . '/libs.log');
$p->cleanFile(__DIR__ . '/configure.backup');

}


# PHP 默认版本 (此文件配置 /sapi/PHP-VERSION.conf 在 build_native_php分支 和 衍生分支 无效)
Expand Down Expand Up @@ -88,12 +96,13 @@
echo PHP_EOL;

// Sync code from php-src
$p->setPhpSrcDir($p->getWorkDir() . '/var/php-' . BUILD_PHP_VERSION);
$p->setPhpSrcDir($p->getWorkDir() . DIRECTORY_SEPARATOR . 'var' . DIRECTORY_SEPARATOR . 'php-' . BUILD_PHP_VERSION);


// Compile directly on the host machine, not in the docker container
if ($p->getInputOption('without-docker') || ($p->isMacos())) {
$p->setWorkDir(__DIR__);
$p->setBuildDir(__DIR__ . '/thirdparty');
$p->setBuildDir(__DIR__ . DIRECTORY_SEPARATOR . 'thirdparty');
}

$p->setRootDir(__DIR__);
Expand All @@ -102,7 +111,7 @@
if ($p->getInputOption('with-php-src')) {
$p->setPhpSrcDir($p->getInputOption('with-php-src'));
} else {
$p->setPhpSrcDir($p->getRootDir() . '/thirdparty/php-src');
$p->setPhpSrcDir($p->getRootDir() . DIRECTORY_SEPARATOR . 'thirdparty' . DIRECTORY_SEPARATOR . 'php-src');
}

//设置PHP 安装目录
Expand Down Expand Up @@ -158,6 +167,8 @@
$p->setProxyConfig($proxyConfig, $http_proxy);
}

die();


if ($p->isMacos()) {
//$p->setExtraLdflags('-undefined dynamic_lookup');
Expand Down
4 changes: 2 additions & 2 deletions sapi/quickstart/linux/run-rhel-container.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
#!/usr/bin/env bash

set -exu
set -xu
__DIR__=$(
cd "$(dirname "$0")"
pwd
Expand Down
23 changes: 15 additions & 8 deletions sapi/quickstart/windows/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
# windows 快速准备构建环境
# windows 快速准备构建环境 (2种构建方式)

## [windows cygwin 环境 构建步骤](../../../docs/Cygwin.md)
1. 原生构建
2. cygwin 环境 构建

## 双击如下两个脚本,自动下载cygwin 和 cygwin安装依赖库
## 一、原生构建

### [windows 原生构建步骤](native-build/README.md)

## 二、cygwin 环境 构建

cygwin 环境 构建 快速开始,双击如下两个脚本,自动下载cygwin 和 cygwin安装依赖库

```shell

Expand All @@ -14,18 +21,18 @@ sapi\quickstart\windows\install-cygwin.bat

```

# windows 软连接例子
### [windows cygwin 构建步骤](../../../docs/Cygwin.md)

## 三、其它

### windows 软连接例子

```bash

mklink composer composer.phar

```

## 其他

1. [windows build native php](./windows-native.md)
1. [install msys2 ](./install-msys2.md)



Expand Down
24 changes: 24 additions & 0 deletions sapi/quickstart/windows/cygwin-build/download-cygwin.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
@echo off

setlocal

echo %~dp0
cd /d %~dp0
cd /d ..\..\..\..\

set "__PROJECT__=%cd%"
echo %cd%

md %__PROJECT__%\var\windows-cygwin-build-deps\

cd /d %__PROJECT__%\var\windows-cygwin-build-deps\

:: cygwin site: https://cygwin.com/
curl.exe -fSLo setup-x86_64.exe https://cygwin.com/setup-x86_64.exe


:: exit /b 0

cd /d %__PROJECT__%\

endlocal
Original file line number Diff line number Diff line change
@@ -1,4 +1,19 @@
@echo off

setlocal

echo %~dp0
cd /d %~dp0
cd /d ..\..\..\..\

set "__PROJECT__=%cd%"
echo %cd%

md %__PROJECT__%\var\windows-cygwin-build-deps\

cd /d %__PROJECT__%\var\windows-cygwin-build-deps\


:: cygwin安装多个包,包之间,用逗号分隔

setup-x86_64.exe --no-desktop --no-shortcuts --no-startmenu --quiet-mode --disable-buggy-antivirus --site https://mirrors.ustc.edu.cn/cygwin/ --packages make,git,curl,wget,tar,libtool,bison,gcc-g++,autoconf,automake,openssl,libpcre2-devel,libssl-devel,libcurl-devel,libxml2-devel,libxslt-devel,libgmp-devel,ImageMagick,libpng-devel,libjpeg-devel,libfreetype-devel,libwebp-devel,libsqlite3-devel,zlib-devel,libbz2-devel,liblz4-devel,liblzma-devel,libzip-devel,libicu-devel,libonig-devel,libcares-devel,libsodium-devel,libyaml-devel,libMagick-devel,libzstd-devel,libbrotli-devel,libreadline-devel,libintl-devel,libpq-devel,libssh2-devel,libidn2-devel,gettext-devel,coreutils,openssl-devel
Expand All @@ -9,4 +24,6 @@ setup-x86_64.exe --quiet-mode --disable-buggy-antivirus --site https://mirr

setup-x86_64.exe --quiet-mode --disable-buggy-antivirus --site https://mirrors.ustc.edu.cn/cygwin/ --packages libzstd-devel

cd /d %__PROJECT__%\

endlocal
3 changes: 0 additions & 3 deletions sapi/quickstart/windows/download-cygwin.bat

This file was deleted.

5 changes: 0 additions & 5 deletions sapi/quickstart/windows/download-msys2.bat

This file was deleted.

Loading