Browse Source

Merge pull request #35 from cscott/fixes

Makefile fixes.
Patrick Reilly 11 years ago
parent
commit
c4d155351d
3 changed files with 12 additions and 2 deletions
  1. 1 0
      Makefile.frag
  2. 5 0
      README.md
  3. 6 2
      config.m4

+ 1 - 0
Makefile.frag

@@ -1,3 +1,4 @@
+PHP_TEST_SHARED_EXTENSIONS+=-d extension=$(EXTENSION_DIR)/json.so
 
 testv8: all
 	$(PHP_EXECUTABLE) -n -d extension_dir=./modules -d extension=v8js.so test.php

+ 5 - 0
README.md

@@ -33,11 +33,16 @@ git clone https://github.com/v8/v8.git
 cd v8
 make dependencies
 make native library=shared -j8
+sudo mkdir -p /usr/lib /usr/include
 sudo cp out/native/lib.target/libv8.so /usr/lib/libv8.so
 sudo cp include/v8* /usr/include
 
 ```
 
+If you don't want to overwrite the system copy of v8, replace `/usr` in
+the above commands with `/tmp/v8-install` and then add
+`--with-v8js=/tmp/v8-install` to the php-v8js `./configure` command below.
+
 Compile php-v8js itself
 -----------------------
 

+ 6 - 2
config.m4

@@ -5,9 +5,10 @@ PHP_ARG_WITH(v8js, for V8 Javascript Engine,
 
 if test "$PHP_V8JS" != "no"; then
   SEARCH_PATH="/usr/local /usr"
-  SEARCH_FOR="/include/v8.h"
+  SEARCH_FOR="include/v8.h"
   
   if test -r $PHP_V8JS/$SEARCH_FOR; then
+    LDFLAGS="$LDFLAGS -Wl,--rpath=$PHP_V8JS/$PHP_LIBDIR"
     V8_DIR=$PHP_V8JS
   else
     AC_MSG_CHECKING([for V8 files in default path])
@@ -32,8 +33,10 @@ if test "$PHP_V8JS" != "no"; then
   AC_CACHE_CHECK(for V8 version, ac_cv_v8_version, [
 old_LIBS=$LIBS
 old_LDFLAGS=$LDFLAGS
-LDFLAGS=-L$V8_DIR/$PHP_LIBDIR
+old_CPPFLAGS=$CPPFLAGS
+LDFLAGS="-Wl,--rpath=$V8_DIR/$PHP_LIBDIR -L$V8_DIR/$PHP_LIBDIR"
 LIBS=-lv8
+CPPFLAGS=-I$V8_DIR/include
 AC_LANG_SAVE
 AC_LANG_CPLUSPLUS
 AC_TRY_RUN([#include <v8.h>
@@ -55,6 +58,7 @@ int main ()
 AC_LANG_RESTORE
 LIBS=$old_LIBS
 LDFLAGS=$old_LDFLAGS
+CPPFLAGS=$old_CPPFLAGS
 ])
 
   if test "$ac_cv_v8_version" != "NONE"; then