[ice] fix compilation with java 7 (submitted upstream) fix compilation with php 5.4 (patch from Remi Colle

Haïkel Guémar hguemar at fedoraproject.org
Thu Dec 29 10:47:26 UTC 2011


commit 24ed0e81857f55015e4d55322a8b88776482fc38
Author: Haïkel Guémar <hguemar at fedoraproject.org>
Date:   Thu Dec 29 11:43:51 2011 +0100

    fix compilation with java 7 (submitted upstream)
    fix compilation with php 5.4 (patch from Remi Collet -- submitted upstream)
    spec cleaning

 glacier2router.init     |  110 -------------------
 glacier2router.service  |   15 +++
 ice-3.4.2-java7.patch   |   26 +++++
 ice-3.4.2-php54.patch   |  272 +++++++++++++++++++++++++++++++++++++++++++++++
 ice.spec                |  259 +++++++++++++++++++++++++--------------------
 icegridnode.init        |  111 -------------------
 icegridnode.service     |   15 +++
 icegridregistry.init    |  111 -------------------
 icegridregistry.service |   15 +++
 9 files changed, 486 insertions(+), 448 deletions(-)
---
diff --git a/glacier2router.service b/glacier2router.service
new file mode 100644
index 0000000..a0890b2
--- /dev/null
+++ b/glacier2router.service
@@ -0,0 +1,15 @@
+[Unit]
+Description=Firewall solution for ZeroC ICE
+After=syslog.target
+After=network.target
+
+[Service]
+Type=simple
+User=iceuser
+Group=iceuser
+
+ExecStart=/usr/bin/glacier2router --Ice.Config=/etc/glacier2router.conf
+Restart=always
+
+[Install]
+WantedBy=multi-user.target
diff --git a/ice-3.4.2-java7.patch b/ice-3.4.2-java7.patch
new file mode 100644
index 0000000..dce14d5
--- /dev/null
+++ b/ice-3.4.2-java7.patch
@@ -0,0 +1,26 @@
+diff --git a/java/src/IceInternal/OutgoingConnectionFactory.java b/java/src/IceInternal/OutgoingConnectionFactory.java
+index 2036c08..c4bc58f 100644
+--- a/java/src/IceInternal/OutgoingConnectionFactory.java
++++ b/java/src/IceInternal/OutgoingConnectionFactory.java
+@@ -17,7 +17,7 @@ public final class OutgoingConnectionFactory
+     private static class MultiHashMap<K, V> extends java.util.HashMap<K, java.util.List<V>>
+     {
+         public void
+-        put(K key, V value)
++        put_(K key, V value)
+         {
+             java.util.List<V> list = this.get(key);
+             if(list == null)
+@@ -693,9 +693,9 @@ public final class OutgoingConnectionFactory
+             throw ex;
+ 	}
+ 
+-        _connections.put(ci.connector, connection);
+-        _connectionsByEndpoint.put(connection.endpoint(), connection);
+-        _connectionsByEndpoint.put(connection.endpoint().compress(true), connection);
++        _connections.put_(ci.connector, connection);
++        _connectionsByEndpoint.put_(connection.endpoint(), connection);
++        _connectionsByEndpoint.put_(connection.endpoint().compress(true), connection);
+         return connection;
+     }
+ 
diff --git a/ice-3.4.2-php54.patch b/ice-3.4.2-php54.patch
new file mode 100644
index 0000000..4b1e8f7
--- /dev/null
+++ b/ice-3.4.2-php54.patch
@@ -0,0 +1,272 @@
+diff -up Ice-3.4.2/php/src/IcePHP/Communicator.cpp.php54 Ice-3.4.2/php/src/IcePHP/Communicator.cpp
+--- Ice-3.4.2/php/src/IcePHP/Communicator.cpp.php54	2011-06-15 21:44:00.000000000 +0200
++++ Ice-3.4.2/php/src/IcePHP/Communicator.cpp	2011-12-28 09:07:57.231738495 +0100
+@@ -1092,11 +1092,11 @@ ZEND_FUNCTION(Ice_getProperties)
+ //
+ // Predefined methods for Communicator.
+ //
+-static function_entry _interfaceMethods[] =
++static zend_function_entry _interfaceMethods[] =
+ {
+     {0, 0, 0}
+ };
+-static function_entry _classMethods[] =
++static zend_function_entry _classMethods[] =
+ {
+     ZEND_ME(Ice_Communicator, __construct, NULL, ZEND_ACC_PRIVATE|ZEND_ACC_CTOR)
+     ZEND_ME(Ice_Communicator, destroy, NULL, ZEND_ACC_PUBLIC)
+diff -up Ice-3.4.2/php/src/IcePHP/Connection.cpp.php54 Ice-3.4.2/php/src/IcePHP/Connection.cpp
+--- Ice-3.4.2/php/src/IcePHP/Connection.cpp.php54	2011-06-15 21:44:00.000000000 +0200
++++ Ice-3.4.2/php/src/IcePHP/Connection.cpp	2011-12-28 09:07:57.231738495 +0100
+@@ -271,11 +271,11 @@ handleConnectionCompare(zval* zobj1, zva
+ //
+ // Predefined methods for Connection.
+ //
+-static function_entry _interfaceMethods[] =
++static zend_function_entry _interfaceMethods[] =
+ {
+     {0, 0, 0}
+ };
+-static function_entry _connectionClassMethods[] =
++static zend_function_entry _connectionClassMethods[] =
+ {
+     ZEND_ME(Ice_Connection, __construct, NULL, ZEND_ACC_PRIVATE|ZEND_ACC_CTOR)
+     ZEND_ME(Ice_Connection, __toString, NULL, ZEND_ACC_PUBLIC)
+@@ -297,7 +297,7 @@ ZEND_METHOD(Ice_ConnectionInfo, __constr
+ //
+ // Predefined methods for ConnectionInfo.
+ //
+-static function_entry _connectionInfoClassMethods[] =
++static zend_function_entry _connectionInfoClassMethods[] =
+ {
+     ZEND_ME(Ice_ConnectionInfo, __construct, NULL, ZEND_ACC_PRIVATE|ZEND_ACC_CTOR)
+     {0, 0, 0}
+diff -up Ice-3.4.2/php/src/IcePHP/Endpoint.cpp.php54 Ice-3.4.2/php/src/IcePHP/Endpoint.cpp
+--- Ice-3.4.2/php/src/IcePHP/Endpoint.cpp.php54	2011-06-15 21:44:00.000000000 +0200
++++ Ice-3.4.2/php/src/IcePHP/Endpoint.cpp	2011-12-28 09:07:57.232738495 +0100
+@@ -216,7 +216,7 @@ handleEndpointInfoFreeStorage(void* p TS
+     zend_objects_free_object_storage(static_cast<zend_object*>(p) TSRMLS_CC);
+ }
+ 
+-static function_entry _interfaceMethods[] =
++static zend_function_entry _interfaceMethods[] =
+ {
+     {0, 0, 0}
+ };
+@@ -224,7 +224,7 @@ static function_entry _interfaceMethods[
+ //
+ // Predefined methods for Endpoint.
+ //
+-static function_entry _endpointMethods[] =
++static zend_function_entry _endpointMethods[] =
+ {
+     ZEND_ME(Ice_Endpoint, __construct, NULL, ZEND_ACC_PRIVATE|ZEND_ACC_CTOR)
+     ZEND_ME(Ice_Endpoint, __toString, NULL, ZEND_ACC_PUBLIC)
+@@ -236,7 +236,7 @@ static function_entry _endpointMethods[]
+ //
+ // Predefined methods for EndpointInfo.
+ //
+-static function_entry _endpointInfoMethods[] =
++static zend_function_entry _endpointInfoMethods[] =
+ {
+     ZEND_ME(Ice_EndpointInfo, __construct, NULL, ZEND_ACC_PRIVATE|ZEND_ACC_CTOR)
+     ZEND_ME(Ice_EndpointInfo, type, NULL, ZEND_ACC_PUBLIC)
+diff -up Ice-3.4.2/php/src/IcePHP/Init.cpp.php54 Ice-3.4.2/php/src/IcePHP/Init.cpp
+--- Ice-3.4.2/php/src/IcePHP/Init.cpp.php54	2011-06-15 21:44:00.000000000 +0200
++++ Ice-3.4.2/php/src/IcePHP/Init.cpp	2011-12-28 09:07:57.233738495 +0100
+@@ -25,7 +25,7 @@ ZEND_DECLARE_MODULE_GLOBALS(ice)
+ //
+ // Entries for all global functions.
+ //
+-function_entry ice_functions[] =
++zend_function_entry ice_functions[] =
+ {
+     ICEPHP_COMMUNICATOR_FUNCTIONS
+     ICEPHP_COMMUNICATOR_NS_FUNCTIONS
+diff -up Ice-3.4.2/php/src/IcePHP/Logger.cpp.php54 Ice-3.4.2/php/src/IcePHP/Logger.cpp
+--- Ice-3.4.2/php/src/IcePHP/Logger.cpp.php54	2011-06-15 21:44:00.000000000 +0200
++++ Ice-3.4.2/php/src/IcePHP/Logger.cpp	2011-12-28 09:07:57.233738495 +0100
+@@ -226,11 +226,11 @@ handleClone(zval* zv TSRMLS_DC)
+ //
+ // Predefined methods for Logger.
+ //
+-static function_entry _interfaceMethods[] =
++static zend_function_entry _interfaceMethods[] =
+ {
+     {0, 0, 0}
+ };
+-static function_entry _classMethods[] =
++static zend_function_entry _classMethods[] =
+ {
+     ZEND_ME(Ice_Logger, __construct, NULL, ZEND_ACC_PRIVATE|ZEND_ACC_CTOR)
+     ZEND_ME(Ice_Logger, __toString, NULL, ZEND_ACC_PUBLIC)
+diff -up Ice-3.4.2/php/src/IcePHP/Operation.cpp.php54 Ice-3.4.2/php/src/IcePHP/Operation.cpp
+--- Ice-3.4.2/php/src/IcePHP/Operation.cpp.php54	2011-06-15 21:44:00.000000000 +0200
++++ Ice-3.4.2/php/src/IcePHP/Operation.cpp	2011-12-28 09:17:24.728752077 +0100
+@@ -218,7 +218,7 @@ IcePHP::OperationI::~OperationI()
+     if(_zendFunction)
+     {
+         delete []_zendFunction->arg_info;
+-        efree(_zendFunction->function_name);
++        efree(const_cast<char *>(_zendFunction->function_name));
+         efree(_zendFunction);
+     }
+ }
+@@ -238,12 +238,18 @@ IcePHP::OperationI::function()
+         for(p = inParams.begin(); p != inParams.end(); ++p, ++i)
+         {
+             getArgInfo(argInfo[i], *p, false);
++#if PHP_VERSION_ID < 50399
++            // php 5.4 : zend_arg_info.required_num_args removed.
+             argInfo[i].required_num_args = static_cast<zend_uint>(numParams);
++#endif
+         }
+         for(p = outParams.begin(); p != outParams.end(); ++p, ++i)
+         {
+             getArgInfo(argInfo[i], *p, true);
++#if PHP_VERSION_ID < 50399
++            // php 5.4 : zend_arg_info.required_num_args removed.
+             argInfo[i].required_num_args = static_cast<zend_uint>(numParams);
++#endif
+         }
+ 
+         string fixed = fixIdent(name);
+@@ -255,9 +261,12 @@ IcePHP::OperationI::function()
+         _zendFunction->prototype = 0;
+         _zendFunction->num_args = static_cast<zend_uint>(numParams);
+         _zendFunction->arg_info = argInfo;
++#if PHP_VERSION_ID < 50399
++        // php 5.4 use fn_flags ZEND_ACC_PASS_REST_BY_REFERENCE, ZEND_ACC_RETURN_REFERENCE
+         _zendFunction->pass_rest_by_reference = 0;
+-        _zendFunction->required_num_args = _zendFunction->num_args;
+         _zendFunction->return_reference = 0;
++#endif
++        _zendFunction->required_num_args = _zendFunction->num_args;
+         _zendFunction->handler = ZEND_FN(IcePHP_Operation_call);
+     }
+ 
+@@ -295,13 +304,22 @@ IcePHP::OperationI::getArgInfo(zend_arg_
+     arg.allow_null = 1;
+     if(SequenceInfoPtr::dynamicCast(info) || DictionaryInfoPtr::dynamicCast(info))
+     {
++#if PHP_VERSION_ID < 50399
+         arg.array_type_hint = 1;
++        arg.return_reference = 0;
++#else
++        arg.type_hint = IS_ARRAY;
++#endif
+     }
+     else
+     {
++#if PHP_VERSION_ID < 50399
+         arg.array_type_hint = 0;
++        arg.return_reference = 0;
++#else
++        arg.type_hint = 0;
++#endif
+     }
+-    arg.return_reference = 0;
+     arg.pass_by_reference = out ? 1 : 0;
+ }
+ 
+diff -up Ice-3.4.2/php/src/IcePHP/Properties.cpp.php54 Ice-3.4.2/php/src/IcePHP/Properties.cpp
+--- Ice-3.4.2/php/src/IcePHP/Properties.cpp.php54	2011-06-15 21:44:00.000000000 +0200
++++ Ice-3.4.2/php/src/IcePHP/Properties.cpp	2011-12-28 09:07:57.234738495 +0100
+@@ -589,11 +589,11 @@ ZEND_FUNCTION(Ice_createProperties)
+ //
+ // Predefined methods for Properties.
+ //
+-static function_entry _interfaceMethods[] =
++static zend_function_entry _interfaceMethods[] =
+ {
+     {0, 0, 0}
+ };
+-static function_entry _classMethods[] =
++static zend_function_entry _classMethods[] =
+ {
+     ZEND_ME(Ice_Properties, __construct, NULL, ZEND_ACC_PRIVATE|ZEND_ACC_CTOR)
+     ZEND_ME(Ice_Properties, __toString, NULL, ZEND_ACC_PUBLIC)
+diff -up Ice-3.4.2/php/src/IcePHP/Proxy.cpp.php54 Ice-3.4.2/php/src/IcePHP/Proxy.cpp
+--- Ice-3.4.2/php/src/IcePHP/Proxy.cpp.php54	2011-06-15 21:44:00.000000000 +0200
++++ Ice-3.4.2/php/src/IcePHP/Proxy.cpp	2011-12-28 09:07:57.235738495 +0100
+@@ -59,7 +59,11 @@ extern "C"
+ static zend_object_value handleAlloc(zend_class_entry* TSRMLS_DC);
+ static void handleFreeStorage(void* TSRMLS_DC);
+ static zend_object_value handleClone(zval* TSRMLS_DC);
++#if PHP_VERSION_ID < 50399
+ static union _zend_function* handleGetMethod(zval**, char*, int TSRMLS_DC);
++#else
++static union _zend_function* handleGetMethod(zval**, char*, int, const _zend_literal* TSRMLS_DC);
++#endif
+ static int handleCompare(zval*, zval* TSRMLS_DC);
+ }
+ 
+@@ -1461,7 +1465,11 @@ handleClone(zval* zv TSRMLS_DC)
+ extern "C"
+ #endif
+ static union _zend_function*
++#if PHP_VERSION_ID < 50399
+ handleGetMethod(zval** zv, char* method, int len TSRMLS_DC)
++#else
++handleGetMethod(zval** zv, char* method, int len, const _zend_literal* literal TSRMLS_DC)
++#endif
+ {
+     zend_function* result;
+ 
+@@ -1470,7 +1478,11 @@ handleGetMethod(zval** zv, char* method,
+     // any of our predefined proxy methods. If it returns 0, then we return a
+     // function that will check the class definition.
+     //
++#if PHP_VERSION_ID < 50399
+     result = zend_get_std_object_handlers()->get_method(zv, method, len TSRMLS_CC);
++#else
++    result = zend_get_std_object_handlers()->get_method(zv, method, len, literal TSRMLS_CC);
++#endif
+     if(!result)
+     {
+         Wrapper<ProxyPtr>* obj = Wrapper<ProxyPtr>::extract(*zv TSRMLS_CC);
+@@ -1532,7 +1544,7 @@ handleCompare(zval* zobj1, zval* zobj2 T
+ //
+ // Predefined methods for ObjectPrx.
+ //
+-static function_entry _proxyMethods[] =
++static zend_function_entry _proxyMethods[] =
+ {
+     ZEND_ME(Ice_ObjectPrx, __construct, NULL, ZEND_ACC_PRIVATE|ZEND_ACC_CTOR)
+     ZEND_ME(Ice_ObjectPrx, __toString, NULL, ZEND_ACC_PUBLIC)
+diff -up Ice-3.4.2/php/src/IcePHP/Types.cpp.php54 Ice-3.4.2/php/src/IcePHP/Types.cpp
+--- Ice-3.4.2/php/src/IcePHP/Types.cpp.php54	2011-06-15 21:44:00.000000000 +0200
++++ Ice-3.4.2/php/src/IcePHP/Types.cpp	2011-12-28 09:07:57.236738495 +0100
+@@ -2853,7 +2853,7 @@ ZEND_FUNCTION(IcePHP_stringifyException)
+ //
+ // Predefined methods for IcePHP_TypeInfo.
+ //
+-static function_entry _typeInfoMethods[] =
++static zend_function_entry _typeInfoMethods[] =
+ {
+     {0, 0, 0}
+ };
+@@ -2861,7 +2861,7 @@ static function_entry _typeInfoMethods[]
+ //
+ // Predefined methods for IcePHP_ExceptionInfo.
+ //
+-static function_entry _exceptionInfoMethods[] =
++static zend_function_entry _exceptionInfoMethods[] =
+ {
+     {0, 0, 0}
+ };
+diff -up Ice-3.4.2/php/src/IcePHP/Util.cpp.php54 Ice-3.4.2/php/src/IcePHP/Util.cpp
+--- Ice-3.4.2/php/src/IcePHP/Util.cpp.php54	2011-06-15 21:44:00.000000000 +0200
++++ Ice-3.4.2/php/src/IcePHP/Util.cpp	2011-12-28 09:07:57.237738495 +0100
+@@ -38,7 +38,11 @@ IcePHP::createWrapper(zend_class_entry*
+ 
+     obj->properties = static_cast<HashTable*>(emalloc(sizeof(HashTable)));
+     zend_hash_init(obj->properties, 0, 0, dtor_wrapper, 0);
++#if PHP_VERSION_ID < 50399
+     zend_hash_copy(obj->properties, &ce->default_properties, (copy_ctor_func_t)zval_add_ref, &tmp, sizeof(zval*));
++#else
++    object_properties_init( (zend_object*)obj, ce );
++#endif
+ 
+     return obj;
+ }
diff --git a/ice.spec b/ice.spec
index d0857cc..14641ca 100644
--- a/ice.spec
+++ b/ice.spec
@@ -4,10 +4,11 @@
 
 %global php_extdir %(php-config --extension-dir 2>/dev/null || echo %{_libdir}/php4)
 %global php_apiver %((echo 0; php -i 2>/dev/null | sed -n 's/^PHP API => //p') | tail -1)
+%global systemddir /lib/systemd/system
 
 Name:           ice
 Version:        3.4.2
-Release:        5%{?dist}
+Release:        6%{?dist}
 Summary:        ZeroC Object-Oriented middleware
 
 Group:          System Environment/Libraries
@@ -20,11 +21,11 @@ Source2:        icegridgui
 Source3:        IceGridAdmin.desktop
 Source4:        Ice-README.Fedora
 Source5:        glacier2router.conf
-Source6:        glacier2router.init
+Source6:        glacier2router.service
 Source7:        icegridnode.conf
-Source8:        icegridnode.init
+Source8:        icegridnode.service
 Source9:        icegridregistry.conf
-Source10:       icegridregistry.init
+Source10:       icegridregistry.service
 Source11:       ice.ini
 Source12:       ice.pth
 # Remove reference to Windows L&F
@@ -39,7 +40,10 @@ Patch2:         Ice-3.4.0-s390.patch
 Patch3:         Ice-3.3-dont-build-demo-test.patch
 # disable the CSharp interface
 Patch4:         ice-3.4.1-no-mono.patch
-
+# fix java 7 compilation
+Patch5:         ice-3.4.2-java7.patch
+# fix php 5.4 compilation
+Patch6:         ice-3.4.2-php54.patch
 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
 # Ice doesn't officially support ppc64 at all
@@ -64,7 +68,7 @@ BuildRequires: mono-core, mono-devel
 BuildRequires: libmcpp-devel >= 2.7.2
 BuildRequires: dos2unix
 BuildRequires: java-1.6.0-openjdk-devel
-BuildRequires: jgoodies-forms jgoodies-looks jgoodies-common
+BuildRequires: jgoodies-forms jgoodies-looks
 BuildRequires: /usr/bin/convert
 BuildRequires: desktop-file-utils
 
@@ -86,12 +90,14 @@ Group: Development/Tools
 Requires: ice%{?_isa} = %{version}-%{release}
 # Requirements for the users
 Requires(pre): shadow-utils%{?isa}
-# Requirements for the init.d services
-Requires(post): /sbin/chkconfig%{?isa}
-Requires(preun): /sbin/chkconfig%{?isa}
-Requires(preun): /sbin/service%{?isa}
+# Requirements for the systemd services
+BuildRequires: systemd-units
+Requires(post): systemd-units
+Requires(preun): systemd-units
+Requires(postun): systemd-units
+Requires(post): systemd-sysv
 %description servers
-Ice services to run through /etc/rc.d/init.d
+Ice services (systemd)
 
 %package devel
 Summary: C++ tools for developing Ice applications
@@ -205,115 +211,105 @@ Tools for developing Ice applications in PHP.
 %if ! 0%{?with_mono}
 %patch4 -p1
 %endif
-%setup -q -n ice-3.4.2-man-pages -T -b 1
-rm -f slice2docbook.1
+%patch5 -p1
+%patch6 -p1 -b .php54
+%{__tar} xf %{SOURCE1}
+rm -f ice-3.4.2-man-pages/slice2docbook.1
+
 
 %build
 # Set the CLASSPATH correctly for the Java compile
 export CLASSPATH=`build-classpath db jgoodies-forms jgoodies-looks`
 
 # Compile the main Ice runtime
-cd ${RPM_BUILD_DIR}/Ice-%{version}
 make CXXFLAGS="%{optflags} -fPIC" CFLAGS="%{optflags} -fPIC" embedded_runpath_prefix="" libsubdir=%{_lib}
 
 # Rebuild the Java ImportKey class
-cd ${RPM_BUILD_DIR}/Ice-%{version}/cpp/src/ca
+pushd cpp/src/ca
 rm *.class
 javac ImportKey.java
+popd
 
 # Create the IceGrid icon
-cd $RPM_BUILD_DIR/Ice-%{version}/java
+pushd java
 cd resources/icons
 convert icegrid.ico temp.png
 mv temp-8.png icegrid.png
 rm temp*.png
-
+popd
 
 %install
-rm -rf $RPM_BUILD_ROOT
-mkdir -p $RPM_BUILD_ROOT
-
+rm -rf %{buildroot}
+mkdir -p %{buildroot}
 # Do the basic "make install"
-cd $RPM_BUILD_DIR/Ice-%{version}
-make prefix=$RPM_BUILD_ROOT GACINSTALL=yes GAC_ROOT=$RPM_BUILD_ROOT%{_prefix}/lib embedded_runpath_prefix="" libsubdir=%{_lib} install
+make prefix=%{buildroot} GACINSTALL=yes GAC_ROOT=%{buildroot}%{_prefix}/lib embedded_runpath_prefix="" libsubdir=%{_lib} install
 
 ## install java bindings in the right place
-mkdir -p ${RPM_BUILD_ROOT}%{_javadir}
-mv ${RPM_BUILD_ROOT}/lib/ant-ice.jar $RPM_BUILD_ROOT%{_javadir}/ant-ice-%{version}.jar
-ln -s ant-ice-%{version}.jar $RPM_BUILD_ROOT%{_javadir}/ant-ice.jar
-mv ${RPM_BUILD_ROOT}/lib/Ice.jar $RPM_BUILD_ROOT%{_javadir}/Ice-%{version}.jar
-ln -s Ice-%{version}.jar $RPM_BUILD_ROOT%{_javadir}/Ice.jar
-mv ${RPM_BUILD_ROOT}/lib/Freeze.jar $RPM_BUILD_ROOT%{_javadir}/Freeze-%{version}.jar
-ln -s Freeze-%{version}.jar $RPM_BUILD_ROOT%{_javadir}/Freeze.jar
+mkdir -p %{buildroot}%{_javadir}
+mv %{buildroot}/lib/ant-ice.jar %{buildroot}%{_javadir}/ant-ice-%{version}.jar
+ln -s ant-ice-%{version}.jar %{buildroot}%{_javadir}/ant-ice.jar
+mv %{buildroot}/lib/Ice.jar %{buildroot}%{_javadir}/Ice-%{version}.jar
+ln -s Ice-%{version}.jar %{buildroot}%{_javadir}/Ice.jar
+mv %{buildroot}/lib/Freeze.jar %{buildroot}%{_javadir}/Freeze-%{version}.jar
+ln -s Freeze-%{version}.jar %{buildroot}%{_javadir}/Freeze.jar
+
 
 ## install IceGrid GUI in the right place
-mkdir -p ${RPM_BUILD_ROOT}%{_datadir}/Ice-%{version}
-mv ${RPM_BUILD_ROOT}/lib/IceGridGUI.jar $RPM_BUILD_ROOT%{_datadir}/Ice-%{version}
-mkdir -p ${RPM_BUILD_ROOT}%{_datadir}/icons/hicolor/48x48/apps/
-cp -p ${RPM_BUILD_DIR}/Ice-%{version}/java/resources/icons/icegrid.png \
-        ${RPM_BUILD_ROOT}%{_datadir}/icons/hicolor/48x48/apps/
-mkdir -p ${RPM_BUILD_ROOT}%{_bindir}
+mkdir -p %{buildroot}%{_datadir}/Ice-%{version}
+mv %{buildroot}/lib/IceGridGUI.jar %{buildroot}%{_datadir}/Ice-%{version}
+mkdir -p %{buildroot}%{_datadir}/icons/hicolor/48x48/apps/
+cp -p java/resources/icons/icegrid.png \
+   %{buildroot}%{_datadir}/icons/hicolor/48x48/apps/
+mkdir -p %{buildroot}%{_bindir}
 cp -p %{SOURCE2} ${RPM_BUILD_ROOT}%{_bindir}
 sed -i -e "s#DIR#%{_datadir}/Ice-%{version}#" $RPM_BUILD_ROOT%{_bindir}/icegridgui
 
 %if 0%{?rhel}
 desktop-file-install \
-        --dir=${RPM_BUILD_ROOT}%{_datadir}/applications \
+        --dir=%{buildroot}%{_datadir}/applications \
         --vendor = zeroc \
         %{SOURCE3}
 %else
 desktop-file-install \
-        --dir=${RPM_BUILD_ROOT}%{_datadir}/applications \
+        --dir=%{buildroot}%{_datadir}/applications \
         %{SOURCE3}
 %endif
 
 # Move other rpm-specific files into the right place (README, service stuff)
-mkdir -p $RPM_BUILD_ROOT%{_defaultdocdir}/Ice-%{version}
-cp -p %{SOURCE4} $RPM_BUILD_ROOT/%{_defaultdocdir}/Ice-%{version}/README.Fedora
-
-## install SysV services configuration
-## glacier2router
-install -Dp -m0644 %{SOURCE5} $RPM_BUILD_ROOT%{_sysconfdir}/glacier2router.conf
-install -Dp -m0755 %{SOURCE6} $RPM_BUILD_ROOT%{_initddir}/glacier2router
-## icegridnode
-install -Dp -m0644 %{SOURCE7} $RPM_BUILD_ROOT%{_sysconfdir}/icegridnode.conf
-install -Dp -m0755 %{SOURCE8} $RPM_BUILD_ROOT%{_initddir}/icegridnode
-## icegridregistry
-install -Dp -m0644 %{SOURCE9} $RPM_BUILD_ROOT%{_sysconfdir}/icegridregistry.conf
-install -Dp -m0755 %{SOURCE10} $RPM_BUILD_ROOT%{_initddir}/icegridregistry
-mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/lib/icegrid
+mkdir -p %{buildroot}%{_defaultdocdir}/Ice-%{version}
+cp -p %{SOURCE4} %{buildroot}/%{_defaultdocdir}/Ice-%{version}/README.Fedora
 
 # "make install" assumes it's going into a directory under /opt.
 # Move things to where they should be in an RPM setting (adapted from
 # the original ZeroC srpm).
-install -p -m0755 -t $RPM_BUILD_ROOT%{_bindir} $RPM_BUILD_ROOT/bin/*
-rm -rf $RPM_BUILD_ROOT/bin
-mkdir -p $RPM_BUILD_ROOT%{_includedir}
-mv $RPM_BUILD_ROOT/include/* ${RPM_BUILD_ROOT}%{_includedir}
-mkdir -p $RPM_BUILD_ROOT%{_libdir}
+install -p -m0755 -t %{buildroot}%{_bindir} %{buildroot}/bin/*
+rm -rf %{buildroot}/bin
+mkdir -p %{buildroot}%{_includedir}
+mv %{buildroot}/include/* %{buildroot}%{_includedir}
+mkdir -p %{buildroot}%{_libdir}
 # There are a couple of files that end up installed in /lib, not %%{_libdir},
 # so we try this move too.
 %if 0%{?with_mono}
-mkdir -p $RPM_BUILD_ROOT%{_libdir}/pkgconfig
-install -p -m0644 -t $RPM_BUILD_ROOT%{_libdir}/pkgconfig \
-         $RPM_BUILD_ROOT/lib/pkgconfig/*.pc
+mkdir -p %{buildroot}%{_libdir}/pkgconfig
+install -p -m0644 -t %{buildroot}%{_libdir}/pkgconfig \
+         %{buildroot}/lib/pkgconfig/*.pc
 %endif
-install -p -m0755 -t $RPM_BUILD_ROOT%{_libdir}/ \
-         $RPM_BUILD_ROOT/%{_lib}/*.so* 
+install -p -m0755 -t %{buildroot}%{_libdir}/ \
+         %{buildroot}/%{_lib}/*.so*
 # Move the ImportKey.class file
-mkdir -p ${RPM_BUILD_ROOT}%{_datadir}/Ice-%{version}
-mv $RPM_BUILD_ROOT/lib/ImportKey.class ${RPM_BUILD_ROOT}%{_datadir}/Ice-%{version}
-rm -rf $RPM_BUILD_ROOT/%{_lib} $RPM_BUILD_ROOT/lib
+mkdir -p %{buildroot}%{_datadir}/Ice-%{version}
+mv %{buildroot}/lib/ImportKey.class %{buildroot}%{_datadir}/Ice-%{version}
+rm -rf %{buildroot}/%{_lib} %{buildroot}/lib
 
-mkdir -p $RPM_BUILD_ROOT%{_defaultdocdir}/Ice-%{version}
-mv $RPM_BUILD_ROOT/help/IceGridAdmin $RPM_BUILD_ROOT%{_defaultdocdir}/Ice-%{version}
+mkdir -p %{buildroot}%{_defaultdocdir}/Ice-%{version}
+mv %{buildroot}/help/IceGridAdmin %{buildroot}%{_defaultdocdir}/Ice-%{version}
 
 # Copy the man pages into the correct directory
-mkdir -p $RPM_BUILD_ROOT%{_mandir}/man1
-cp -p $RPM_BUILD_DIR/ice-3.4.2-man-pages/*.1 $RPM_BUILD_ROOT%{_mandir}/man1
+mkdir -p %{buildroot}%{_mandir}/man1
+cp -p ice-3.4.2-man-pages/*.1 %{buildroot}%{_mandir}/man1
 
 # Fix the encoding and line-endings of all the IceGridAdmin documentation files
-pushd $RPM_BUILD_ROOT%{_defaultdocdir}/Ice-%{version}/IceGridAdmin
+pushd %{buildroot}%{_defaultdocdir}/Ice-%{version}/IceGridAdmin
 chmod a-x *
 for f in *.js *.css *.js;
 do
@@ -332,61 +328,80 @@ popd
 # .NET spec files (for csharp-devel) -- convert the paths
 for f in IceGrid Glacier2 IceBox Ice IceStorm IcePatch2;
 do
-    mv $RPM_BUILD_ROOT%{_bindir}/$f.xml \
-       $RPM_BUILD_ROOT%{_prefix}/lib/mono/gac/$f/%{version}.*/
+    mv %{buildroot}%{_bindir}/$f.xml \
+       %{buildroot}%{_prefix}/lib/mono/gac/$f/%{version}.*/
     # fix xml files permissions
-    chmod 0644 $RPM_BUILD_ROOT%{_prefix}/lib/mono/gac/$f/%{version}.*/*.xml
+    chmod 0644 %{buildroot}%{_prefix}/lib/mono/gac/$f/%{version}.*/*.xml
 done
 %else
 # clean some files when building without mono
-rm $RPM_BUILD_ROOT%{_bindir}/slice2cs
-rm $RPM_BUILD_ROOT%{_mandir}/man1/iceboxnet.exe.1*
-rm $RPM_BUILD_ROOT%{_mandir}/man1/slice2cs.1*
+rm %{buildroot}%{_bindir}/slice2cs
+rm %{buildroot}%{_mandir}/man1/iceboxnet.exe.1*
+rm %{buildroot}%{_mandir}/man1/slice2cs.1*
 %endif
 
 ## install PHP bindings in the right place
 install -D -p -m0644 %{SOURCE11} \
-        $RPM_BUILD_ROOT%{_sysconfdir}/php.d/%{name}.ini
-install -D -p -m0755 ${RPM_BUILD_ROOT}/php/IcePHP.so \
-        ${RPM_BUILD_ROOT}%{php_extdir}/IcePHP.so
-rm -f ${RPM_BUILD_ROOT}/php/IcePHP.so
-mkdir -p ${RPM_BUILD_ROOT}%{_datadir}/php
-mv ${RPM_BUILD_ROOT}/php/* ${RPM_BUILD_ROOT}%{_datadir}/php
+           %{buildroot}%{_sysconfdir}/php.d/%{name}.ini
+install -D -p -m0755 %{buildroot}/php/IcePHP.so \
+        %{buildroot}%{php_extdir}/IcePHP.so
+rm -f %{buildroot}/php/IcePHP.so
+mkdir -p %{buildroot}%{_datadir}/php
+mv %{buildroot}/php/* %{buildroot}%{_datadir}/php
+
 
 ## install Python and Ruby bindings in the right place
 # remove shebangs from python/ruby modules
-for f in $RPM_BUILD_ROOT/python/Ice.py $RPM_BUILD_ROOT/ruby/*.rb;
+for f in %{buildroot}/python/Ice.py %{buildroot}/ruby/*.rb;
 do
     grep -v '/usr/bin/env' $f > $f.tmp
     mv $f.tmp $f
 done
-mkdir -p ${RPM_BUILD_ROOT}%{ruby_sitearch}
-mv $RPM_BUILD_ROOT/ruby/* ${RPM_BUILD_ROOT}%{ruby_sitearch}
-mkdir -p ${RPM_BUILD_ROOT}%{python_sitearch}/Ice
-mv ${RPM_BUILD_ROOT}/python/* ${RPM_BUILD_ROOT}%{python_sitearch}/Ice
-cp -p %{SOURCE12} $RPM_BUILD_ROOT%{python_sitearch}
+mkdir -p %{buildroot}%{ruby_sitearch}
+mv %{buildroot}/ruby/* %{buildroot}%{ruby_sitearch}
+mkdir -p %{buildroot}%{python_sitearch}/Ice
+mv %{buildroot}/python/* %{buildroot}%{python_sitearch}/Ice
+cp -p %{SOURCE12} %{buildroot}%{python_sitearch}
 # fix permissions for Python/Ruby C extensions libraries
-chmod 0755 $RPM_BUILD_ROOT%{python_sitearch}/Ice/IcePy.so*
-chmod 0755 $RPM_BUILD_ROOT%{ruby_sitearch}/IceRuby.so*
+chmod 0755 %{buildroot}%{python_sitearch}/Ice/IcePy.so*
+chmod 0755 %{buildroot}%{ruby_sitearch}/IceRuby.so*
 
-mkdir -p ${RPM_BUILD_ROOT}%{_datadir}/Ice-%{version}
-mv $RPM_BUILD_ROOT/config/* ${RPM_BUILD_ROOT}%{_datadir}/Ice-%{version}
-mv $RPM_BUILD_ROOT/slice ${RPM_BUILD_ROOT}%{_datadir}/Ice-%{version}
+mkdir -p %{buildroot}%{_datadir}/Ice-%{version}
+mv %{buildroot}/config/* %{buildroot}%{_datadir}/Ice-%{version}
+mv %{buildroot}/slice %{buildroot}%{_datadir}/Ice-%{version}
 # Somehow, some files under "slice" end up with executable permissions -- ??
-find ${RPM_BUILD_ROOT}%{_datadir}/Ice-%{version} -name "*.ice" | xargs chmod a-x
+find %{buildroot}%{_datadir}/Ice-%{version} -name "*.ice" | xargs chmod a-x
 
 
 # Move license files into the documentation directory
-mkdir -p ${RPM_BUILD_ROOT}%{_defaultdocdir}/Ice-%{version}
-mv $RPM_BUILD_ROOT/ICE_LICENSE ${RPM_BUILD_ROOT}%{_defaultdocdir}/Ice-%{version}/ICE_LICENSE
-mv $RPM_BUILD_ROOT/LICENSE ${RPM_BUILD_ROOT}%{_defaultdocdir}/Ice-%{version}/LICENSE
+mkdir -p %{buildroot}%{_defaultdocdir}/Ice-%{version}
+mv %{buildroot}/ICE_LICENSE %{buildroot}%{_defaultdocdir}/Ice-%{version}/ICE_LICENSE
+mv %{buildroot}/LICENSE %{buildroot}%{_defaultdocdir}/Ice-%{version}/LICENSE
 # Copy in the other files too
-cd ${RPM_BUILD_DIR}/Ice-%{version}
-cp CHANGES RELEASE_NOTES  ${RPM_BUILD_ROOT}%{_defaultdocdir}/Ice-%{version}/
+cp CHANGES RELEASE_NOTES  %{buildroot}%{_defaultdocdir}/Ice-%{version}/
+
+## install systemd services configuration
+mkdir -p %{buildroot}%{systemddir}
+mkdir -p %{buildroot}%{_sysconfdir}
+## glacier2router
+install -p -m0644 %{SOURCE5} %{buildroot}%{_sysconfdir}
+install -p -m0644 %{SOURCE6} %{buildroot}%{systemddir}
+## icegridnode
+install -p -m0644 %{SOURCE7} %{buildroot}%{_sysconfdir}
+install -p -m0644 %{SOURCE8} %{buildroot}%{systemddir}
+## icegridregistry
+install -p -m0644 %{SOURCE9} %{buildroot}%{_sysconfdir}
+install -p -m0644 %{SOURCE10} %{buildroot}%{systemddir}
+mkdir -p %{buildroot}%{_localstatedir}/lib/icegrid
 
 
 %clean
-rm -rf $RPM_BUILD_ROOT
+rm -rf %{buildroot}
+
+
+%check
+# Minimum check for php extension
+LD_LIBRARY_PATH=%{buildroot}%{_libdir} php -n -d extension_dir=%{buildroot}%{php_extdir} -d extension=IcePHP.so -m | grep ice
 
 
 %files
@@ -433,9 +448,9 @@ rm -rf $RPM_BUILD_ROOT
 
 %files servers
 %defattr(-,root,root,-)
-%{_initddir}/icegridregistry
-%{_initddir}/icegridnode
-%{_initddir}/glacier2router
+%{systemddir}/icegridregistry.service
+%{systemddir}/icegridnode.service
+%{systemddir}/glacier2router.service
 %config(noreplace) %{_sysconfdir}/icegridregistry.conf
 %config(noreplace) %{_sysconfdir}/icegridnode.conf
 %config(noreplace) %{_sysconfdir}/glacier2router.conf
@@ -450,25 +465,31 @@ getent passwd iceuser > /dev/null || \
 exit 0
 
 %post servers
-/sbin/chkconfig --add icegridregistry
-/sbin/chkconfig --add icegridnode
-/sbin/chkconfig --add glacier2router
+if [ $1 -eq 1 ] ; then
+    # Initial installation
+    /bin/systemctl daemon-reload >/dev/null 2>&1 || :
+fi
 
 %preun servers
-if [ $1 = 0 ]; then
-        /sbin/service icegridregistry stop >/dev/null 2>&1 || :
-        /sbin/chkconfig --del icegridregistry
-        /sbin/service icegridnode stop >/dev/null 2>&1 || :
-        /sbin/chkconfig --del icegridnode
-        /sbin/service glacier2router stop >/dev/null 2>&1 || :
-        /sbin/chkconfig --del glacier2router
+if [ $1 -eq 0 ] ; then
+    # Package removal, not upgrade
+    /bin/systemctl --no-reload disable icegridregistry.service \
+                   > /dev/null 2>&1 || :
+    /bin/systemctl stop icegridregistry.service > /dev/null 2>&1 || :
+    /bin/systemctl --no-reload disable icegridnode.service > /dev/null 2>&1 || :
+    /bin/systemctl stop icegridnode.service > /dev/null 2>&1 || :
+    /bin/systemctl --no-reload disable glacier2router.service \
+                   > /dev/null 2>&1 || :
+    /bin/systemctl stop glacier2router.service > /dev/null 2>&1 || :
 fi
 
 %postun servers
-if [ "$1" -ge "1" ]; then
-        /sbin/service icegridregistry condrestart >/dev/null 2>&1 || :
-        /sbin/service icegridnode condrestart >/dev/null 2>&1 || :
-        /sbin/service glacier2router condrestart >/dev/null 2>&1 || :
+/bin/systemctl daemon-reload >/dev/null 2>&1 || :
+if [ $1 -ge 1 ] ; then
+    # Package upgrade, not uninstall
+    /bin/systemctl try-restart icegridregistry.service >/dev/null 2>&1 || :
+    /bin/systemctl try-restart icegridnode.service >/dev/null 2>&1 || :
+    /bin/systemctl try-restart glacier2router.service >/dev/null 2>&1 || :
 fi
 
 %files devel
@@ -575,6 +596,12 @@ fi
 
 
 %changelog
+* Wed Dec 28 2011 Haïkel Guémar <hguemar at fedoraproject.org> - 3.4.2-6
+- move services from upstart to systemd
+- fix build with java7
+- fix build with php54 (patch contributed by Remi Collet)
+- spec cleaning
+
 * Tue Nov 29 2011 Christian Krause <chkr at fedoraproject.org> - 3.4.2-5
 - Change paths for mono assemblies according to updated packaging
   guidelines (http://fedoraproject.org/wiki/Packaging:Mono)
diff --git a/icegridnode.service b/icegridnode.service
new file mode 100644
index 0000000..9f921be
--- /dev/null
+++ b/icegridnode.service
@@ -0,0 +1,15 @@
+[Unit]
+Description=Deployment and monitoring server for ZeroC ICE (slave node)
+After=syslog.target
+After=network.target
+
+[Service]
+Type=simple
+User=iceuser
+Group=iceuser
+
+ExecStart=/usr/bin/icegridnode --Ice.Config=/etc/icegridnode.conf
+Restart=always
+
+[Install]
+WantedBy=multi-user.target
diff --git a/icegridregistry.service b/icegridregistry.service
new file mode 100644
index 0000000..7c11ce2
--- /dev/null
+++ b/icegridregistry.service
@@ -0,0 +1,15 @@
+[Unit]
+Description=Deployment and monitoring server for ZeroC ICE (master node)
+After=syslog.target
+After=network.target
+
+[Service]
+Type=simple
+User=iceuser
+Group=iceuser
+
+ExecStart=/usr/bin/icegridregistry --Ice.Config=/etc/icegridregistry.conf
+Restart=always
+
+[Install]
+WantedBy=multi-user.target


More information about the scm-commits mailing list