--- /dev/null
+CXX=g++
+CXXFLAGS=-fPIC -O2 -g
+EXT_DIR=$(DESTDIR)$(shell php-config --extension-dir)/
+
+php_itkacl.so: itkacl_wrap.o
+ $(CXX) -shared -o php_itkacl.so itkacl_wrap.o -litkacl
+
+itkacl_wrap.o: itkacl_wrap.cpp
+ $(CXX) $(shell php-config --includes) $(CXXFLAGS) -c itkacl_wrap.cpp -o itkacl_wrap.o
+
+itkacl_wrap.cpp:
+ swig -php5 -c++ itkacl.i
+
+clean:
+ $(RM) itkacl.php itkacl_wrap.cpp itkacl_wrap.o php_itkacl.h php_itkacl.so
+
+install:
+ mkdir -p $(EXT_DIR)
+ install php_itkacl.so $(EXT_DIR)
+
+.PHONY: clean install
--- /dev/null
+php5-itkacl (2.0) unstable; urgency=low
+
+ * Initial release.
+
+ -- Steinar H. Gunderson <sesse@samfundet.no> Tue, 14 May 2013 19:02:22 +0200
--- /dev/null
+Source: php5-itkacl
+Priority: extra
+Maintainer: Steinar H. Gunderson <sesse@samfundet.no>
+Build-Depends: debhelper (>= 7.0.50~), libitkacl-dev, php5-dev
+Standards-Version: 3.9.1
+Section: php
+
+Package: php5-itkacl
+Section: php
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}, ${php:Depends}
+Description: PHP bindings for ITKACL
+ PHP module to interface to ITKACL.
--- /dev/null
+; configuration for php itkacl module
+extension=php_itkacl.so
--- /dev/null
+etc/php5/conf.d
--- /dev/null
+#!/usr/bin/make -f
+# -*- makefile -*-
+
+clean:
+ dh_testdir
+ dh_clean
+ $(MAKE) clean
+
+build:
+ dh_testdir
+ $(MAKE)
+
+binary-indep:
+
+binary-arch:
+ dh_testroot
+ dh_prep
+ dh_installdirs
+ $(MAKE) install DESTDIR=debian/php5-itkacl
+ install -m 0644 -o root -g root debian/itkacl.ini debian/php5-itkacl/etc/php5/conf.d/
+ dh_installdocs
+ dh_installchangelogs
+ dh_compress
+ dh_fixperms
+ dh_strip
+ dh_makeshlibs
+ dh_shlibdeps
+ echo "php:Depends=phpapi-$(shell php-config --phpapi)" >> debian/php5-itkacl.substvars
+ dh_installdeb
+ dh_gencontrol
+ dh_md5sums
+ dh_builddeb
+
+binary: binary-arch
--- /dev/null
+/* SWIG interface for libitkacl */
+%module itkacl
+%include exception.i
+
+/*
+ * ITKACL now threadsafe using exceptions found in PHP5.
+ * -1 is return on unexpected event, eg. realm doesn't exist.
+ *
+ * The naming of the class is somewhat braindamaged due to SWIG
+ * restrictions.
+ */
+%inline %{
+ /* This is due to Swig forgetting one file */
+ #include <php5/Zend/zend_exceptions.h>
+
+ extern "C" int itkacl_check(char *realm, char *user, char *errmsg, size_t errmsgsize);
+
+ class itkaclwrap {
+ public:
+ static int check(char *realm, char *user);
+ };
+
+ int itkaclwrap::check(char *realm, char *user)
+ {
+ char itkacl_errmsg[1024];
+ int ret = itkacl_check(realm, user, itkacl_errmsg, 1024);
+ if (ret == -1) {
+ SWIG_exception(SWIG_RuntimeError,itkacl_errmsg);
+ } else {
+ return ret == 0;
+ }
+ }
+%}
+