Skip to content

Commit

Permalink
Enable Intl extension, linking against external libicu.
Browse files Browse the repository at this point in the history
In the future we might build this statically, using the gyp binding
from the npm `icu-bidi` package.
  • Loading branch information
cscott committed Nov 4, 2015
1 parent 4050e2b commit 7492d1e
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 10 deletions.
11 changes: 8 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,12 @@ before_install:
- if test "$TRAVIS_OS_NAME $CC" = "osx clang" ; then
export MACOSX_DEPLOYMENT_TARGET=10.7 ;
fi
# we need to install libicu on os x
- |
if test "$TRAVIS_OS_NAME" = "osx"; then
brew update | head ;
brew install icu4c ;
fi
# check if tag exists and matches package.json
- scripts/validate_tag.sh
- echo $NODE_VERSION
Expand All @@ -116,11 +122,10 @@ before_script:
script:
- node --version
- npm --version
- LIBCRYPT=''
- if test "$TRAVIS_OS_NAME" = "osx"; then LIBCRYPT="--libcrypt=-liconv" ; fi
- DEBUG=''
- if test "$RELEASE" = "false"; then DEBUG='--debug' ; fi
- if test -z "$EXTERNAL_LIBPHP" ; then npm install --build-from-source $LIBCRYPT $DEBUG; else npm install --build-from-source --libphp5=external $DEBUG; fi
- if false ; then export V=1 ; fi # Useful when debugging build/link failures.
- if test -z "$EXTERNAL_LIBPHP" ; then npm install --build-from-source $DEBUG; else npm install --build-from-source --libphp5=external $DEBUG; fi
- node-pre-gyp package testpackage
# OSX malloc debugging
- |
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# php-embed x.x.x (not yet released)
* Add and enable Opcache extension for opcode caching (performance).
* Add and enable Intl extension (fast internationalization support).

# php-embed 0.5.2 (2015-11-03)
* Ensure PHP private properties aren't writable.
Expand Down
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -345,10 +345,12 @@ export CXX="g++-5"
export CC="gcc-5"
```
On Mac OSX, you need to limit support to OS X 10.7 and above in order
to get C++11 support. Something like the following should work:
to get C++11 support. You will also need to install `libicu`.
Something like the following should work:

```sh
export MACOSX_DEPLOYMENT_TARGET=10.7 ;
export MACOSX_DEPLOYMENT_TARGET=10.7
brew install icu4c
```

Developers hacking on the code will probably want to use:
Expand Down
32 changes: 27 additions & 5 deletions deps/libphp5.gyp
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
{
'includes': [ 'common-libphp5.gypi' ],
# these are libraries not needed on osx
'variables': { 'libcrypt%':'-lcrypt -lrt -lnsl' },
'target_defaults': {
'default_configuration': 'Release',
'configurations': {
Expand Down Expand Up @@ -45,12 +43,30 @@
'-stdlib=libc++'
],
},
'variables': {
'configure_options': [],
},
'conditions': [
['OS == "win"', {
'defines': [
'WIN32'
],
}]
}],
['OS == "linux"', {
'link_settings': {
# these are libraries not needed on osx
'libraries': [ '-lcrypt', '-lrt', '-lnsl' ],
},
}],
['OS == "mac"', {
'variables': {
'configure_options': ['--with-icu-dir=/usr/local/opt/icu4c/'],
},
'link_settings': {
'ldflags': [ '-L/usr/local/opt/icu4c/lib' ],
'libraries': [ '-L/usr/local/opt/icu4c/lib', '-liconv' ],
}
}],
],
},

Expand Down Expand Up @@ -87,9 +103,11 @@
'--enable-opcache=shared',
# mediawiki says this is necessary
'--with-zlib', '--enable-mbstring',
# and this is recommended:
'--enable-intl',
# turn off some unnecessary bits
'--disable-cli', '--disable-cgi',
'<@(configure_options)'
'>@(configure_options)'
]
}
]
Expand Down Expand Up @@ -135,10 +153,14 @@
],
},
'link_settings': {
'ldflags': [],
'libraries': [
'<(SHARED_INTERMEDIATE_DIR)/build/lib/libphp5.a',
# these match `php-config --libs`
'<(libcrypt) -lresolv -lm -ldl -lxml2'
'-lresolv -lstdc++ -lz -lm -ldl -lxml2',
# these match `icu-config --ldflags`, and are needed because
# we are building the Intl extension.
'-licui18n -licuuc -licudata -licuio'
]
},
'sources': [
Expand Down

0 comments on commit 7492d1e

Please sign in to comment.