Skip to content
This repository has been archived by the owner on Apr 20, 2023. It is now read-only.

Commit

Permalink
Merge pull request #189 from facebook/chore/add-php-built-in-for-macos
Browse files Browse the repository at this point in the history
chore: Add PHP built in for MacOS
  • Loading branch information
nataliemt authored May 24, 2022
2 parents 1cf3fdb + 31a6541 commit 2a150b8
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 8 deletions.
1 change: 1 addition & 0 deletions .flowconfig
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
.*/electron-packager/test/.*
.*/webserver/*
.*/build/*
.*/**/malformed_package_json/package.json

[include]
node_modules/electron
Expand Down
26 changes: 21 additions & 5 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,31 @@ message "Downloading PHP binaries for Windows..."
rm -Rf bin
mkdir bin
cd bin
curl -o php.zip https://windows.php.net/downloads/releases/archives/php-7.4.9-Win32-vc15-x86.zip
mkdir php
cd php
curl -o php-win32.zip https://windows.php.net/downloads/releases/archives/php-7.4.9-Win32-vc15-x86.zip
message "Extracting PHP binary..."
unzip php.zip -d ./php
rm php.zip
unzip php-win32.zip -d ./win32
rm php-win32.zip
message "PHP binary extracted"
cp ../php.ini ./php/php.ini
cp ../../php.ini ./win32/php.ini

message "Installing PHP dependencies..."
message "Downloading PHP binaries for Mac..."
curl --insecure --show-error --location --globoff https://github.com/php/php-src/archive/refs/tags/php-7.4.29.tar.gz | tar -zx
message "PHP source code downloaded"
cd php-src-php-7.4.29
message "Configuring PHP source code..."
./buildconf --force
mkdir ../darwin
./configure --prefix=$(pwd)/../darwin --enable-shared=no --enable-static=yes --without-iconv --without-pdo-sqlite --without-sqlite3 -with-openssl=$(which openssl)
message "Installing PHP binaries for Mac..."
make -j8
make install
cd ..
rm -r -f php-src-php-7.4.29

message "Installing PHP dependencies..."
cd ../../
cd webserver
composer install
message "PHP dependencies installed"
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
},
"devDependencies": {
"devtron": "^1.4.0",
"electron": "^11.3.0",
"electron": "^11.5.0",
"electron-packager": "^15.2.0",
"enzyme": "^3.11.0",
"enzyme-adapter-react-15": "^1.4.1",
Expand Down
12 changes: 10 additions & 2 deletions src/js/utils/preview-webserver.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,17 @@ class PreviewWebserver {
this.phpServer.server({
port: this.port,
base: path.resolve(__dirname) + '/../../../webserver',
bin: path.resolve(__dirname) + '/../../../bin/php/php.exe',
bin: path.resolve(__dirname) + '/../../../bin/php/win32/php.exe',
});
} else {
} else if (process.platform === 'darwin'){
this.phpServer.server({
port: this.port,
base: path.resolve(__dirname) + '/../../../webserver',
bin: path.resolve(__dirname) + '/../../../bin/php/darwin/bin/php',
});
}
else
{
this.phpServer.server({
port: this.port,
base: path.resolve(__dirname) + '/../../../webserver',
Expand Down

0 comments on commit 2a150b8

Please sign in to comment.