%global shortver 3.9 %global mediumver %{shortver}.1 Name: cmu-ipc Version: %{mediumver}a Release: 1%{?dist} Summary: Flexible, efficient message passing between processes License: BSD URL: http://www.cs.cmu.edu/~IPC/ Source0: http://www.cs.cmu.edu/afs/cs/project/TCA/ftp/ipc-%{version}.tar.gz patch0: fixes.patch #fix problems that fails the build, waiting for the reply from upstream #put the java files to the correct directory #add a missing semicolon in XDR.l so it can compile patch1: fedora2.patch #distribution specific patch #adjust paths #add soname field #avoid making tests during builds #honor compiler flags patch2: ppc64le.patch patch3: buildjar.patch patch4: python3.patch #Distribution specific patch BuildRequires: perl BuildRequires: dnf grep gawk gcc gcc-c++ %description IPC provides high-level support for connecting processes using TCP/IP sockets and sending data between processes. It takes care of opening sockets, registering messages, and sending and receiving messages, including both anonymous publish/subscribe and client/server type messages. The IPC library contains functions to marshall (serialize) and unmarshall (de-serialize) data, handles data transfer between machines with different Endian conventions, invoke user-defined handlers when a message is received, and invoke user-defined callbacks at set intervals. IPC uses the more efficient Unix sockets when processes are on the same processor, and does byte-swapping only when necessary. IPC now supports multi-threaded applications. %package devel Summary: IPC development files Requires: %{name}%{?_isa} = %{version}-%{release} %description devel IPC development files. %package -n python3-%{name} Summary: IPC python API BuildRequires: swig BuildRequires: python3-devel Requires: %{name}%{?_isa} = %{version}-%{release} %description -n python3-%{name} IPC python3 interface %package -n python2-%{name} Summary: IPC python API BuildRequires: swig BuildRequires: python2-devel Requires: %{name}%{?_isa} = %{version}-%{release} %description -n python2-%{name} IPC python2 interface %package -n java-%{name} Summary: IPC java API BuildRequires: java-1.8.0-openjdk-devel Requires: %{name}%{?_isa} = %{version}-%{release} %description -n java-%{name} IPC java interface %package xdrgen Summary: IPC XDR data structure specification parser BuildRequires: bison BuildRequires: flex Requires: %{name}%{?_isa} = %{version}-%{release} %description xdrgen Xdrgen parses an XDR data structure specification (similar to a list of C type definitions), and generates a C header which includes both type definitions and macros defining the IPC format strings. %prep %setup -q -n ipc-%{mediumver} %patch0 -p2 %patch1 -p2 %ifarch ppc64le %patch2 -p2 %endif sed -e 's|@libpath@|%{_libdir}|' %{PATCH3} | %{__patch} -p2 -F 0 cp %{PATCH4} python/python3.patch %build echo 'thismachine' uname -m export RPMOPTFLAGS='%{optflags}' export RPMLDFLAGS='%{?__global_ldflags}' export JAVA_JNI_H_DIR=$(dnf repoquery *openjdk-devel --installed -l -C |grep jni.h | sed 's|\/jni.h||' | tail -1) export JAVA_JNI_MD_HDIR=$(dnf repoquery *openjdk-devel --installed -l -C |grep jni_md.h | sed 's|\/jni_md.h||' | tail -1) #find java header location %make_build install -S -C src #libpic.so will be accessed at the "installed" location when building other components. %make_build install -S mkdir py2 install -p -m 755 lib/Linux*/_IPC.so py2 for f in formatters.p* IPC.p* primFmttrs.p*; do install -p -m 644 python/$f py2 done cd python make clean rm -rf lib obj sharedObj patch -p3 -i python3.patch %make_build all -S %install #Building of all componets require library made in src directory to be 'installed', but %{buildroot} is not accessible buring build. The following install script reinstall them into proper location with correct permissions. mkdir -p %{buildroot}%{_bindir} install -p -m 755 bin/Linux*/central %{buildroot}%{_bindir} install -p -m 755 bin/Linux*/xdrgen %{buildroot}%{_bindir} mkdir -p %{buildroot}%{_libdir}/java-ipc install -p -m 755 lib/Linux*/libipc.so.%{shortver} %{buildroot}%{_libdir}/libipc.so.%{shortver} ln -s ./libipc.so.%{shortver} %{buildroot}%{_libdir}/libipc.so install -p -m 755 lib/Linux*/libipcjava.so.%{shortver} %{buildroot}%{_libdir}/java-ipc/libipcjava.so.%{shortver} ln -s ./libipcjava.so.%{shortver} %{buildroot}%{_libdir}/java-ipc/libipcjava.so mkdir -p %{buildroot}%{python3_sitearch} install -p -m 755 lib/Linux*/_IPC.so %{buildroot}%{python3_sitearch} for f in formatters.p* IPC.p* primFmttrs.p*; do install -p -m 644 python/$f %{buildroot}%{python3_sitearch} done #They are supposed to be byte compiled automatically. export PYTHONPATH=$PYTHONPATH:%{buildroot}%{python2_sitelib} mkdir -p %{buildroot}%{_includedir} install -p -m 644 include/ipc.h %{buildroot}%{_includedir}/ipc.h mkdir -p %{buildroot}%{_jnidir} install -p -m 755 java/build/ipc.jar %{buildroot}%{_jnidir} mkdir -p %{buildroot}%{python2_sitearch} cp -p py2/* %{buildroot}%{python2_sitearch} #%check #Tests provided by upstream are not runable in mock, central server have to be open in background. %files %doc doc/IPC_Manual.pdf # Adobe Makerfile documents were not included because no application on Fedora can open them. %license LICENSE.TXT %{_bindir}/central %{_libdir}/libipc.so.%{shortver} %files devel %{_includedir}/ipc.h %{_libdir}/libipc.so %files -n python2-%{name} %{python2_sitearch}/* %files -n python3-%{name} %{python3_sitearch}/* %files -n java-%{name} %{_libdir}/java-ipc %{_jnidir}/ipc.jar %files xdrgen %doc doc/xdrgen.html %{_bindir}/xdrgen %post -p /sbin/ldconfig %postun -p /sbin/ldconfig %post -n java-%{name} -p /sbin/ldconfig %postun -n java-%{name} -p /sbin/ldconfig %changelog * Mon Aug 14 2017 yecheng <18969068329@163.com> - 3.9.1a-1 Initial packaging -