[packages/php-luasandbox] build hhvm extension, needs lua with c++ build

glen glen at pld-linux.org
Wed Aug 27 18:37:23 CEST 2014


commit 9962da9e86b88f05c99adf7c578f89c30aa223dc
Author: Elan Ruusamäe <glen at delfi.ee>
Date:   Wed Aug 27 19:36:33 2014 +0300

    build hhvm extension, needs lua with c++ build

 php-luasandbox.spec | 63 ++++++++++++++++++++++++++++++++++++++++++++++-------
 1 file changed, 55 insertions(+), 8 deletions(-)
---
diff --git a/php-luasandbox.spec b/php-luasandbox.spec
index dd03c27..cc0e5d9 100644
--- a/php-luasandbox.spec
+++ b/php-luasandbox.spec
@@ -1,11 +1,12 @@
 #
 # Conditional build:
-%bcond_without	tests		# build without tests
+%bcond_without	tests	# build without tests
+%bcond_without	php		# build PHP extension
+%bcond_without	hhvm	# build HHVM extension
 
 %define		php_name	php%{?php_suffix}
 %define		modname	luasandbox
-Summary:	LUA sandbox
-Summary(pl.UTF-8):	%{modname} -
+Summary:	Lua extension for PHP
 Name:		%{php_name}-%{modname}
 # luasandbox_version.h defines 2.0-4
 Version:	2.0
@@ -15,25 +16,43 @@ License:	expat
 Group:		Development/Languages/PHP
 Source0:	https://github.com/wikimedia/mediawiki-php-luasandbox/archive/master/%{modname}-%{version}.tar.gz
 # Source0-md5:	c5745b1c93afc56a16e00c5bc09ad414
-URL:		https://gerrit.wikimedia.org/r/#/admin/projects/mediawiki/php/luasandbox
+URL:		https://www.mediawiki.org/wiki/Extension:Scribunto
 %{?with_tests:BuildRequires:    %{php_name}-cli}
 BuildRequires:	%{php_name}-devel
-BuildRequires:	rpmbuild(macros) >= 1.666
-BuildRequires:	pkgconfig
+BuildRequires:	lua51-devel >= 5.1.5-1.2
 BuildRequires:	luajit-devel
+BuildRequires:	pcre-devel >= 8.10
+BuildRequires:	pkgconfig
+BuildRequires:	rpmbuild(macros) >= 1.666
 %{?requires_php_extension}
 Provides:	php(luasandbox) = %{version}
 BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 
+%define		hhvm_extensiondir	%{_libdir}/hhvm
+
 %description
 PHP extension that provides a sandboxed environment to run Lua scripts
 in.
 
+%package -n hhvm-%{modname}
+Summary:	Lua extension for HHVM
+License:	expat
+Group:		Development/Languages/PHP
+Provides:	hhvm(luasandbox) = %{version}
+
+%description -n hhvm-%{modname}
+HHVM extension that provides a sandboxed environment to run Lua
+scripts in.
+
 %prep
 %setup -qc
-mv mediawiki-php-luasandbox-*/* .
+mv mediawiki-php-luasandbox-* php-src
+mv php-src/{README,CREDITS} .
+cp -a php-src hhvm-src
 
 %build
+%if %{with php}
+cd php-src
 phpize
 %configure
 %{__make}
@@ -50,10 +69,23 @@ export NO_INTERACTION=1 REPORT_EXIT_STATUS=1 MALLOC_CHECK_=2
 %{__make} test \
 	PHP_EXECUTABLE=%{__php}
 %endif
+cd ..
+%endif
+
+%if %{with hhvm}
+cd hhvm-src
+hphpize
+%cmake . \
+	%{?cmake_ccache} \
+	-DHHVM_EXTENSION_DIR=%{hhvm_extensiondir} \
+	-DLUA_USE_CPP=1
+%{__make}
+%endif
 
 %install
 rm -rf $RPM_BUILD_ROOT
-%{__make} install \
+%if %{with php}
+%{__make} install -C php-src \
 	EXTENSION_DIR=%{php_extensiondir} \
 	INSTALL_ROOT=$RPM_BUILD_ROOT
 
@@ -62,6 +94,12 @@ cat <<'EOF' > $RPM_BUILD_ROOT%{php_sysconfdir}/conf.d/%{modname}.ini
 ; Enable %{modname} extension module
 extension=%{modname}.so
 EOF
+%endif
+
+%if %{with hhvm}
+%{__make} install -C hhvm-src \
+	DESTDIR=$RPM_BUILD_ROOT
+%endif
 
 %clean
 rm -rf $RPM_BUILD_ROOT
@@ -74,8 +112,17 @@ if [ "$1" = 0 ]; then
 	%php_webserver_restart
 fi
 
+%if %{with php}
 %files
 %defattr(644,root,root,755)
 %doc README CREDITS
 %config(noreplace) %verify(not md5 mtime size) %{php_sysconfdir}/conf.d/%{modname}.ini
 %attr(755,root,root) %{php_extensiondir}/%{modname}.so
+%endif
+
+%if %{with hhvm}
+%files -n hhvm-%{modname}
+%defattr(644,root,root,755)
+%doc README CREDITS
+%attr(755,root,root) %{hhvm_extensiondir}/%{modname}.so
+%endif
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/php-luasandbox.git/commitdiff/9962da9e86b88f05c99adf7c578f89c30aa223dc



More information about the pld-cvs-commit mailing list