[nx] Use system fontconfig and expat during build. Build executables with rpath to fix prelinking, libs a

Ville Skyttä scop at fedoraproject.org
Sun Jul 3 09:55:57 UTC 2011


commit 2d94dcb76e141580c2a900107be635510ac63bec
Author: Ville Skyttä <ville.skytta at iki.fi>
Date:   Sun Jul 3 12:55:28 2011 +0300

    Use system fontconfig and expat during build.
    Build executables with rpath to fix prelinking, libs and nxagent still to do.
    Fix optflags by patching instead of embedding options in specfile.

 nx-3.5.0-optflags.patch |  127 +++++++++++++++++++++++++++++++++++++++++++++++
 nx-3.5.0-syslibs.patch  |   19 +++++++
 nx.spec                 |   47 ++++++-----------
 3 files changed, 162 insertions(+), 31 deletions(-)
---
diff --git a/nx-3.5.0-optflags.patch b/nx-3.5.0-optflags.patch
index ec1ab94..08603f0 100644
--- a/nx-3.5.0-optflags.patch
+++ b/nx-3.5.0-optflags.patch
@@ -58,3 +58,130 @@ diff -up nx-3.5.0/nxssh/configure~ nx-3.5.0/nxssh/configure
  
  NXCOMPINC="-I../nxcomp"
  NXCOMPLIBS="-L../nxcomp -lXcomp -lstdc++ -lpng -ljpeg -lz"
+diff -up nx-3.5.0/nx-X11/config/cf/host.def~ nx-3.5.0/nx-X11/config/cf/host.def
+--- nx-3.5.0/nx-X11/config/cf/host.def~	2011-06-29 01:14:46.974506460 +0300
++++ nx-3.5.0/nx-X11/config/cf/host.def	2011-07-01 00:20:11.261694918 +0300
+@@ -497,17 +497,17 @@ XCOMM $XFree86: xc/config/cf/xf86site.de
+  * -m486
+  *
+ #define DefaultGcc2i386Opt	-O2 -fno-strength-reduce
+- */
+ 
+ #if defined (LinuxArchitecture)
+ #define DefaultGcc2i386Opt      -g -O3
+ #endif
++ */
+ 
+ /*
+  * Enable all the optimizations on AMD64.
+- */
+ 
+ #define DefaultGcc2AMD64Opt	-g -O3 GccAliasingArgs
++ */
+ 
+ /*
+  * This allows the GCC warning flags to be set.  The default is shown here.
+diff -up nx-3.5.0/nx-X11/config/cf/linux.cf~ nx-3.5.0/nx-X11/config/cf/linux.cf
+--- nx-3.5.0/nx-X11/config/cf/linux.cf~	2005-10-21 22:10:27.000000000 +0300
++++ nx-3.5.0/nx-X11/config/cf/linux.cf	2011-06-29 01:09:13.799185571 +0300
+@@ -837,7 +837,7 @@ InstallNamedTargetNoClobber(install,file
+ #ifdef Arm32Architecture
+ # define DefaultCCOptions
+ # ifndef OptimizedCDebugFlags
+-#  define OptimizedCDebugFlags	-O3
++#  define OptimizedCDebugFlags	$(RPM_OPT_FLAGS)
+ # endif
+ # define LinuxMachineDefines	-D__arm__ -D__arm32__ -U__arm -Uarm
+ # define ServerOSDefines	XFree86ServerOSDefines -DDDXTIME
+@@ -845,7 +845,7 @@ InstallNamedTargetNoClobber(install,file
+ #endif /* Arm32Achitecture */
+ 
+ #ifdef HPArchitecture
+-# define OptimizedCDebugFlags	-O2  GccAliasingArgs
++# define OptimizedCDebugFlags	$(RPM_OPT_FLAGS) GccAliasingArgs
+ # define LinuxMachineDefines	-D__hppa__
+ # define ServerOSDefines	XFree86ServerOSDefines -DDDXTIME
+ # define ServerExtraDefines	-DGCCUSESGAS XFree86ServerDefines
+@@ -909,7 +909,7 @@ InstallNamedTargetNoClobber(install,file
+ 
+ #ifdef s390Architecture
+ # ifndef OptimizedCDebugFlags
+-#  define OptimizedCDebugFlags	-O2 -fomit-frame-pointer GccAliasingArgs
++#  define OptimizedCDebugFlags	$(RPM_OPT_FLAGS) GccAliasingArgs
+ # endif
+ # define LinuxMachineDefines	-D__s390__
+ # define ServerOSDefines	XFree86ServerOSDefines -DDDXTIME
+@@ -918,7 +918,7 @@ InstallNamedTargetNoClobber(install,file
+ 
+ #ifdef s390xArchitecture
+ /*#define DefaultCCOptions	-fsigned-char */
+-#define OptimizedCDebugFlags	-O3 -fomit-frame-pointer
++#define OptimizedCDebugFlags	$(RPM_OPT_FLAGS)
+ #define LinuxMachineDefines	-D__s390x__
+ #define ServerOSDefines		XFree86ServerOSDefines -DDDXTIME
+ #define ServerExtraDefines	-DGCCUSESGAS XFree86ServerDefines -D_XSERVER64
+@@ -926,7 +926,7 @@ InstallNamedTargetNoClobber(install,file
+ 
+ #ifdef SparcArchitecture
+ # ifndef OptimizedCDebugFlags
+-#  define OptimizedCDebugFlags	-O2  GccAliasingArgs
++#  define OptimizedCDebugFlags	$(RPM_OPT_FLAGS) GccAliasingArgs
+ # endif
+ # define LinuxMachineDefines	-D__sparc__
+ # define ServerOSDefines	XFree86ServerOSDefines -DDDXTIME
+@@ -957,7 +957,7 @@ InstallNamedTargetNoClobber(install,file
+ #  endif
+ # endif
+ # ifndef OptimizedCDebugFlags
+-#  define OptimizedCDebugFlags	-O2 SuperHArchOptFlags SuperHEndianFlags  GccAliasingArgs
++#  define OptimizedCDebugFlags	$(RPM_OPT_FLAGS) SuperHArchOptFlags SuperHEndianFlags GccAliasingArgs
+ # endif
+ # define LinuxMachineDefines	-D__sh__
+ # define ServerOSDefines	XFree86ServerOSDefines -DDDXTIME
+diff -up nx-3.5.0/nx-X11/config/cf/xorg.cf~ nx-3.5.0/nx-X11/config/cf/xorg.cf
+--- nx-3.5.0/nx-X11/config/cf/xorg.cf~	2005-10-03 19:08:44.000000000 +0300
++++ nx-3.5.0/nx-X11/config/cf/xorg.cf	2011-06-29 01:10:00.860608947 +0300
+@@ -1557,37 +1557,37 @@ XFREE86JAPANESEDOCDIR = $(DOCDIR)/Japane
+ 
+ #if HasGcc2 && defined(i386Architecture)
+ # ifndef DefaultGcc2i386Opt
+-#  define DefaultGcc2i386Opt -O2 -fno-strength-reduce GccAliasingArgs
++#  define DefaultGcc2i386Opt $(RPM_OPT_FLAGS) -fno-strength-reduce GccAliasingArgs
+ # endif
+ #endif
+ 
+ #if HasGcc2 && defined(AMD64Architecture)
+ # ifndef DefaultGcc2AMD64Opt
+-#  define DefaultGcc2AMD64Opt -O2 -fno-strength-reduce GccAliasingArgs
++#  define DefaultGcc2AMD64Opt $(RPM_OPT_FLAGS) -fno-strength-reduce GccAliasingArgs
+ # endif
+ #endif
+ 
+ #if HasGcc2 && defined(AlphaArchitecture)
+ # ifndef DefaultGcc2AxpOpt
+-#  define DefaultGcc2AxpOpt -O2 GccAliasingArgs
++#  define DefaultGcc2AxpOpt $(RPM_OPT_FLAGS) GccAliasingArgs
+ # endif
+ #endif
+ 
+ #if HasGcc2 && defined(Ppc64Architecture)
+ # ifndef DefaultGcc2Ppc64Opt
+-#  define DefaultGcc2Ppc64Opt -O2 GccAliasingArgs
++#  define DefaultGcc2Ppc64Opt $(RPM_OPT_FLAGS) GccAliasingArgs
+ # endif
+ #endif
+ 
+ #if HasGcc2 && defined(MipsArchitecture)
+ # ifndef DefaultGcc2MipsOpt
+-#  define DefaultGcc2MipsOpt -O2 GccAliasingArgs
++#  define DefaultGcc2MipsOpt $(RPM_OPT_FLAGS) GccAliasingArgs
+ # endif
+ #endif
+ 
+ #if HasGcc2 && defined(PpcArchitecture)
+ # ifndef DefaultGcc2PpcOpt
+-#  define DefaultGcc2PpcOpt -O2 GccAliasingArgs
++#  define DefaultGcc2PpcOpt $(RPM_OPT_FLAGS) GccAliasingArgs
+ # endif
+ #endif
+ 
diff --git a/nx-3.5.0-syslibs.patch b/nx-3.5.0-syslibs.patch
new file mode 100644
index 0000000..9e7e68c
--- /dev/null
+++ b/nx-3.5.0-syslibs.patch
@@ -0,0 +1,19 @@
+diff -up nx-3.5.0/nx-X11/config/cf/host.def~ nx-3.5.0/nx-X11/config/cf/host.def
+--- nx-3.5.0/nx-X11/config/cf/host.def~	2011-05-09 16:20:22.000000000 +0300
++++ nx-3.5.0/nx-X11/config/cf/host.def	2011-06-29 01:13:59.677059431 +0300
+@@ -908,7 +908,6 @@ XCOMM $XFree86: xc/config/cf/xf86site.de
+  *
+ #define HasFontconfig NO
+  */
+-#define HasFontconfig NO
+ 
+ /* 
+  * To use a Fontconfig library already installed outside the default search
+@@ -924,7 +923,6 @@ XCOMM $XFree86: xc/config/cf/xf86site.de
+  *
+ #define HasExpat NO
+  */
+-#define HasExpat NO
+ 
+ /* 
+  * To use a Expat library already installed outside the default search
diff --git a/nx.spec b/nx.spec
index 995f009..62da825 100644
--- a/nx.spec
+++ b/nx.spec
@@ -5,7 +5,7 @@
 Summary: Proxy system for X11
 Name: nx
 Version: 3.5.0
-Release: 2%{?dist}
+Release: 3%{?dist}
 # MIT on the X11 bits
 License: GPLv2 and MIT
 Group: Applications/Internet
@@ -28,6 +28,7 @@ Source8: http://64.34.161.181/download/%{version}/sources/nxscripts-%{version}-1
 Source9: nxwrapper.in
 Source10: docs.tar.bz2
 Patch0: nx-3.5.0-optflags.patch
+Patch1: nx-3.5.0-syslibs.patch
 
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
 
@@ -35,6 +36,7 @@ BuildRequires: gcc-c++, libstdc++-devel, redhat-release, hardlink
 BuildRequires: expat-devel, audiofile-devel, openssl-devel, libjpeg-devel, libpng-devel
 BuildRequires: libXt-devel, xorg-x11-proto-devel, libXp-devel, imake
 BuildRequires: libXdamage-devel, libXrandr-devel, libXtst-devel
+BuildRequires: fontconfig-devel
 # Better mention what we really require on a file basis.
 # Requires: xorg-x11-utils
 
@@ -47,37 +49,16 @@ NX provides a proxy system for the X Window System.
 %prep
 %setup -q -c %{name}-%{version} -T -a0 -a1 -a2 -a3 -a4 -a5 -a6 -a7 -a8
 %patch0 -p1
-export CFLAGS="%{optflags}"
-%ifarch x86_64 ppc64
-grep -rl -- -fPIC . | xargs perl -pi -e's,-fPIC,-fPIC -DPIC,'
-export CFLAGS="$CFLAGS -fPIC -DPIC"
-%endif
-cat >> nx-X11/config/cf/host.def << EOF
-#ifdef i386Architecture
-#undef DefaultGcc2i386Opt
-#define DefaultGcc2i386Opt $CFLAGS -fno-strict-aliasing
-#endif
-#ifdef AMD64Architecture
-#undef DefaultGcc2AMD64Opt
-#define DefaultGcc2AMD64Opt $CFLAGS -fno-strict-aliasing
-#endif
-#ifdef MipsArchitecture
-#undef DefaultGcc2MipsOpt
-#define DefaultGcc2MipsOpt $CFLAGS -fno-strict-aliasing
-#endif
-#ifdef s390xArchitecture
-#undef OptimizedCDebugFlags
-#define OptimizedCDebugFlags $CFLAGS -fno-strict-aliasing
-#endif
-EOF
+%patch1 -p1
 find nx-X11 -name "*.[ch]" -print0 | xargs -0 chmod -c -x
 
 %build
-export CFLAGS="%{optflags}"
+export CFLAGS="%{optflags} -Wl,-rpath,%{_pkglibdir}"
 %ifarch x86_64 ppc64
 export CFLAGS="$CFLAGS -fPIC -DPIC"
 %endif
 export CXXFLAGS="$CFLAGS"
+export RPM_OPT_FLAGS="$CFLAGS"
 
 # The commented parts show how the build would proceed step by step.
 # This information is important in case someone wants to split this package
@@ -99,7 +80,8 @@ pushd nxcompext
 popd
 %endif
 pushd nxssh
-./configure --without-zlib-version-check; make %{?_smp_mflags} nxssh
+LDFLAGS="-Wl,-rpath,%{_pkglibdir}" ./configure --without-zlib-version-check
+make %{?_smp_mflags} nxssh
 popd
 
 %install
@@ -129,17 +111,15 @@ install -p -m 0755 nxcomp/libXcomp.so.*.* \
   nxcompshad/libXcompshad.so.*.* \
   %{buildroot}%{_pkglibdir}
 install -p -m 0755 nxssh/nxssh %{buildroot}%{_pkglibexecdir}
-ln -s %{_pkglibexecdir}/nxwrapper %{buildroot}%{_bindir}/nxssh
+ln -s %{_pkglibexecdir}/nxssh %{buildroot}%{_bindir}/nxssh
 install -p -m 0755 nxproxy/nxproxy %{buildroot}%{_pkglibexecdir}
-ln -s %{_pkglibexecdir}/nxwrapper %{buildroot}%{_bindir}/nxproxy
+ln -s %{_pkglibexecdir}/nxproxy %{buildroot}%{_bindir}/nxproxy
 # set up shared lib symlinks
 /sbin/ldconfig -n %{buildroot}%{_pkglibdir}
-# prelink blacklisting, to be removed once we get rpaths worked out (#689508)
+# prelink blacklisting, to be removed once lib rpaths are worked out (#689508)
 mkdir -p %{buildroot}%{_sysconfdir}/prelink.conf.d
 cat <<EOF > %{buildroot}%{_sysconfdir}/prelink.conf.d/nx.conf
 -b %{_pkglibexecdir}/nxagent
--b %{_pkglibexecdir}/nxproxy
--b %{_pkglibexecdir}/nxssh
 EOF
 # install scripts
 mkdir -p %{buildroot}%{_defaultdocdir}/%{name}-%{version}
@@ -169,6 +149,11 @@ rm -rf %{buildroot}
 %{_pkglibexecdir}
 
 %changelog
+* Sun Jul  3 2011 Ville Skyttä <ville.skytta at iki.fi> - 3.5.0-3
+- Use system fontconfig and expat during build.
+- Build executables with rpath to fix prelinking, libs and nxagent still to do.
+- Fix optflags by patching instead of embedding options in specfile.
+
 * Sat Jun 25 2011 Ville Skyttä <ville.skytta at iki.fi> - 3.5.0-2
 - Update nxcomp and nxssh to 3.5.0-2.
 - Install symlinks instead of duplicate copies of shared libs (#689508).


More information about the scm-commits mailing list