Skip to content

Commit 61295c2

Browse files
committed
compile using phpize / configure / make
1 parent ae4b210 commit 61295c2

File tree

2 files changed

+118
-1
lines changed

2 files changed

+118
-1
lines changed

.gitignore

+44-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,45 @@
11
/.idea
2-
/target
2+
/target
3+
4+
# phpize ignore
5+
fs_notify-*.tgz
6+
*.lo
7+
*.la
8+
.libs
9+
acinclude.m4
10+
aclocal.m4
11+
autom4te.cache
12+
build
13+
config.guess
14+
config.h
15+
config.h.in
16+
config.h.in~
17+
config.log
18+
config.nice
19+
config.status
20+
config.sub
21+
configure
22+
configure.ac
23+
configure.in
24+
include
25+
install-sh
26+
libtool
27+
ltmain.sh
28+
Makefile
29+
Makefile.fragments
30+
Makefile.global
31+
Makefile.objects
32+
missing
33+
mkinstalldirs
34+
modules
35+
php_test_results_*.txt
36+
phpt.*
37+
run-test-info.php
38+
run-tests.php
39+
tests/**/*.diff
40+
tests/**/*.out
41+
tests/**/*.exp
42+
tests/**/*.log
43+
tests/**/*.db
44+
tests/**/*.mem
45+
tmp-php.ini

config.m4

+74
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
dnl Licensed to the Apache Software Foundation (ASF) under one
2+
dnl or more contributor license agreements. See the NOTICE file
3+
dnl distributed with this work for additional information
4+
dnl regarding copyright ownership. The ASF licenses this file
5+
dnl to you under the Apache License, Version 2.0 (the
6+
dnl "License"); you may not use this file except in compliance
7+
dnl with the License. You may obtain a copy of the License at
8+
dnl
9+
dnl http://www.apache.org/licenses/LICENSE-2.0
10+
dnl
11+
dnl Unless required by applicable law or agreed to in writing,
12+
dnl software distributed under the License is distributed on an
13+
dnl "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
dnl KIND, either express or implied. See the License for the
15+
dnl specific language governing permissions and limitations
16+
dnl under the License.
17+
18+
PHP_ARG_ENABLE([fs_notify],
19+
[whether to enable fs_notify support],
20+
[AS_HELP_STRING([--enable-fs-notify],
21+
[Enable fs_notify support])],
22+
[no])
23+
24+
PHP_ARG_ENABLE([cargo_debug], [whether to enable cargo debug mode],
25+
[ --enable-cargo-debug Enable cargo debug], no, no)
26+
27+
if test "$PHP_THREAD_SAFETY" == "yes"; then
28+
AC_MSG_ERROR([fs_notify does not support ZTS])
29+
fi
30+
31+
if test "$PHP_FS_NOTIFY" != "no"; then
32+
AC_PATH_PROG(CARGO, cargo, no)
33+
if ! test -x "$CARGO"; then
34+
AC_MSG_ERROR([cargo command missing, please reinstall the cargo distribution])
35+
fi
36+
37+
AC_DEFINE(HAVE_FS_NOTIFY, 1, [ Have fs_notify support ])
38+
39+
PHP_NEW_EXTENSION(fs_notify, [ ], $ext_shared)
40+
41+
CARGO_MODE_FLAGS="--release"
42+
CARGO_MODE_DIR="release"
43+
44+
if test "$PHP_CARGO_DEBUG" != "no"; then
45+
CARGO_MODE_FLAGS=""
46+
CARGO_MODE_DIR="debug"
47+
fi
48+
49+
cat >>Makefile.objects<< EOF
50+
all: cargo_build
51+
52+
clean: cargo_clean
53+
54+
cargo_build:
55+
PHP_CONFIG=$PHP_PHP_CONFIG cargo build $CARGO_MODE_FLAGS
56+
if [[ -f ./target/$CARGO_MODE_DIR/libphp_ext_fs_notify.dylib ]] ; then \\
57+
cp ./target/$CARGO_MODE_DIR/libphp_ext_fs_notify.dylib ./modules/fs_notify.dylib ; fi
58+
if [[ -f ./target/$CARGO_MODE_DIR/libphp_ext_fs_notify.so ]] ; then \\
59+
cp ./target/$CARGO_MODE_DIR/libphp_ext_fs_notify.so ./modules/fs_notify.so ; fi
60+
61+
cargo_clean:
62+
cargo clean
63+
64+
.PHONY: cargo_build cargo_clean
65+
EOF
66+
67+
AC_CONFIG_LINKS([ \
68+
Cargo.lock:Cargo.lock \
69+
Cargo.toml:Cargo.toml \
70+
build.rs:build.rs \
71+
src:src \
72+
tests:tests \
73+
])
74+
fi

0 commit comments

Comments
 (0)