summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTzafrir Cohen <tzafrir@debian.org>2016-05-15 11:29:38 +0300
committerTzafrir Cohen <tzafrir@debian.org>2016-05-15 11:55:31 +0300
commit354c0797518baa51a1fdcbe9e8921883c45b7895 (patch)
tree3b6955f84db89d91d0a46577d4db6d3eb887eded
parent570590058d16274005a4994fd8f1046d0eaf7f74 (diff)
rpm packaging (using gbp, hence debian/gbp.conf)
-rw-r--r--0001-Makefile-install-DESTDIR-and-more.patch74
-rw-r--r--0002-Don-t-run-ldconfig-on-install.patch22
-rw-r--r--debian/gbp.conf5
-rw-r--r--php-cpp.spec76
4 files changed, 177 insertions, 0 deletions
diff --git a/0001-Makefile-install-DESTDIR-and-more.patch b/0001-Makefile-install-DESTDIR-and-more.patch
new file mode 100644
index 0000000..a6cd7fe
--- /dev/null
+++ b/0001-Makefile-install-DESTDIR-and-more.patch
@@ -0,0 +1,74 @@
+From: Tzafrir Cohen <tzafrir@debian.org>
+Date: Wed, 11 May 2016 14:25:02 +0300
+Subject: Makefile: install: DESTDIR and more
+
+Fix the install target of the Makefile:
+* support DESTDIR
+* create installed directories
+* fix symlink targets
+* less shell scripts: if Makefile if instead
+---
+ Makefile | 29 ++++++++++++++++-------------
+ 1 file changed, 16 insertions(+), 13 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index d3d0596..b7a63e9 100644
+--- a/Makefile
++++ b/Makefile
+@@ -94,7 +94,7 @@ endif
+ # you want to leave that flag out on production servers).
+ #
+
+-COMPILER_FLAGS = -Wall -c -std=c++11 -fvisibility=hidden -DBUILDING_PHPCPP -Wno-write-strings
++COMPILER_FLAGS = -Wall -c -std=c++11 -fvisibility=hidden -DBUILDING_PHPCPP -Wno-write-strings $(CPPFLAGS) $(CXXFLAGS)
+ SHARED_COMPILER_FLAGS = -fpic
+ STATIC_COMPILER_FLAGS =
+ PHP_COMPILER_FLAGS = ${COMPILER_FLAGS} `${PHP_CONFIG} --includes`
+@@ -109,7 +109,7 @@ PHP_COMPILER_FLAGS = ${COMPILER_FLAGS} `${PHP_CONFIG} --includes`
+ # to the linker flags
+ #
+
+-LINKER_FLAGS = -shared
++LINKER_FLAGS = -shared $(LDFLAGS)
+ PHP_LINKER_FLAGS = ${LINKER_FLAGS} `${PHP_CONFIG} --ldflags`
+
+
+@@ -150,6 +150,7 @@ PHP_SHARED_OBJECTS = $(PHP_SOURCES:%.cpp=shared/%.o)
+ COMMON_STATIC_OBJECTS = $(COMMON_SOURCES:%.cpp=static/%.o)
+ PHP_STATIC_OBJECTS = $(PHP_SOURCES:%.cpp=static/%.o)
+
++DESTDIR =
+
+ #
+ # End of the variables section. Here starts the list of instructions and
+@@ -203,17 +204,19 @@ ${PHP_STATIC_OBJECTS}:
+ # The if statements below must be seen as single line by make
+
+ install:
+- ${MKDIR} ${INSTALL_HEADERS}/phpcpp
+- ${CP} phpcpp.h ${INSTALL_HEADERS}
+- ${CP} include/*.h ${INSTALL_HEADERS}/phpcpp
+- if [ -e ${PHP_SHARED_LIBRARY} ]; then \
+- ${CP} ${PHP_SHARED_LIBRARY} ${INSTALL_LIB}/; \
+- ${LN} ${INSTALL_LIB}/${PHP_SHARED_LIBRARY} ${INSTALL_LIB}/libphpcpp.so.$(SONAME); \
+- ${LN} ${INSTALL_LIB}/${PHP_SHARED_LIBRARY} ${INSTALL_LIB}/libphpcpp.so; \
+- fi
+- if [ -e ${PHP_STATIC_LIBRARY} ]; then ${CP} ${PHP_STATIC_LIBRARY} ${INSTALL_LIB}/; \
+- ${LN} ${INSTALL_LIB}/${PHP_STATIC_LIBRARY} ${INSTALL_LIB}/libphpcpp.a; \
+- fi
++ ${MKDIR} -p $(DESTDIR)${INSTALL_HEADERS}/phpcpp
++ ${CP} phpcpp.h $(DESTDIR)${INSTALL_HEADERS}
++ ${CP} include/*.h $(DESTDIR)${INSTALL_HEADERS}/phpcpp
++ ${MKDIR} -p $(DESTDIR)${INSTALL_LIB}
++ifneq ($(wildcard ${PHP_SHARED_LIBRARY}),)
++ ${CP} ${PHP_SHARED_LIBRARY} $(DESTDIR)${INSTALL_LIB}/
++ ${LN} ${PHP_SHARED_LIBRARY} $(DESTDIR)${INSTALL_LIB}/libphpcpp.so.$(SONAME)
++ ${LN} ${PHP_SHARED_LIBRARY} $(DESTDIR)${INSTALL_LIB}/libphpcpp.so
++endif
++ifneq ($(wildcard ${PHP_STATIC_LIBRARY}),)
++ ${CP} ${PHP_STATIC_LIBRARY} $(DESTDIR)${INSTALL_LIB}/
++ ${LN} ${PHP_STATIC_LIBRARY} $(DESTDIR)${INSTALL_LIB}/libphpcpp.a
++endif
+ if `which ldconfig`; then \
+ sudo ldconfig; \
+ fi
diff --git a/0002-Don-t-run-ldconfig-on-install.patch b/0002-Don-t-run-ldconfig-on-install.patch
new file mode 100644
index 0000000..2bc207a
--- /dev/null
+++ b/0002-Don-t-run-ldconfig-on-install.patch
@@ -0,0 +1,22 @@
+From: Tzafrir Cohen <tzafrir@debian.org>
+Date: Sun, 15 May 2016 10:31:34 +0300
+Subject: Don't run ldconfig on install
+
+Another sensible patch. Unlike previous patch, not sure if it will be
+acceptable upstream.
+---
+ Makefile | 3 ---
+ 1 file changed, 3 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index b7a63e9..a117b70 100644
+--- a/Makefile
++++ b/Makefile
+@@ -217,7 +217,4 @@ ifneq ($(wildcard ${PHP_STATIC_LIBRARY}),)
+ ${CP} ${PHP_STATIC_LIBRARY} $(DESTDIR)${INSTALL_LIB}/
+ ${LN} ${PHP_STATIC_LIBRARY} $(DESTDIR)${INSTALL_LIB}/libphpcpp.a
+ endif
+- if `which ldconfig`; then \
+- sudo ldconfig; \
+- fi
+
diff --git a/debian/gbp.conf b/debian/gbp.conf
new file mode 100644
index 0000000..71a8ccf
--- /dev/null
+++ b/debian/gbp.conf
@@ -0,0 +1,5 @@
+[DEFAULT]
+upstream-branch = master
+packaging-branch = rpm
+upstream-tag = v%(version)s
+
diff --git a/php-cpp.spec b/php-cpp.spec
new file mode 100644
index 0000000..af7d27d
--- /dev/null
+++ b/php-cpp.spec
@@ -0,0 +1,76 @@
+Summary: C++ library for developing PHP extensions
+Name: php-cpp
+Version: 1.5.3
+Release: 1
+License: Apache-2.0
+Group: Utilities/System
+Source: %{name}-%{version}.tar.gz
+# Patches auto-generated by git-buildpackage:
+Patch0:0001-Makefile-install-DESTDIR-and-more.patch
+Patch1:0002-Don-t-run-ldconfig-on-install.patch
+URL: https://github.com/CopernicaMarketingSoftware/PHP-CPP
+Vendor: Xorcom Inc
+Packager: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
+Requires: php
+BuildRequires: php-devel
+
+%description
+The PHP-CPP library is a C++ library for developing PHP extensions. It
+offers a collection of well documented and easy-to-use classes that can
+be used and extended to build native extensions for PHP. The full
+documentation can be found on http://www.php-cpp.com.
+
+%package devel
+Summary: C++ library for developing PHP extensions - development headers
+%description devel
+The PHP-CPP library is a C++ library for developing PHP extensions. It
+offers a collection of well documented and easy-to-use classes that can
+be used and extended to build native extensions for PHP. The full
+documentation can be found on http://www.php-cpp.com.
+
+This package includes development headers.
+
+%prep
+%setup
+# 0001-Makefile-install-DESTDIR-and-more.patch
+%patch0 -p1
+# 0002-Don-t-run-ldconfig-on-install.patch
+%patch1 -p1
+
+%build
+%{__make}
+
+%install
+%{__rm} -rf %{buildroot}
+%make_install INSTALL_LIB=%{_libdir}
+
+%post
+/sbin/ldconfig
+
+%postun
+/sbin/ldconfig
+
+%clean
+%{__rm} -rf %{buildroot}
+
+###################################################################
+#
+# File List
+#
+###################################################################
+%files
+%defattr(-, root, root)
+%{_libdir}/libphpcpp.so.*
+%doc README.md
+
+%files devel
+%{_includedir}/phpcpp.h
+%{_includedir}/phpcpp/*
+%{_libdir}/libphpcpp.a*
+%{_libdir}/libphpcpp.so
+%doc Examples/*
+%doc documentation/*
+
+%changelog
+* Thu May 15 2016 tzafrir <tzafrir.cohen@xorcom.com> 1.5.3-1
+- Initial packaging.