From a8e7859796b98968057c8ebc7c808183f6c448ca Mon Sep 17 00:00:00 2001
From: hans <hans@pkgsrc.org>
Date: Wed, 15 Feb 2012 15:25:15 +0000
Subject: Change SunOS definitions to be more compatible with what is used on
 other platforms:  - use similar library installation rules  - use CC, CXX and
 CFLAGS from pkgsrc

---
 x11/xorg-cf-files/Makefile                   |  6 +--
 x11/xorg-cf-files/distinfo                   |  5 ++-
 x11/xorg-cf-files/patches/patch-af           | 33 ++++++++++++++-
 x11/xorg-cf-files/patches/patch-sv4Lib.rules | 63 ++++++++++++++++++++++++++++
 4 files changed, 100 insertions(+), 7 deletions(-)
 create mode 100644 x11/xorg-cf-files/patches/patch-sv4Lib.rules

diff --git a/x11/xorg-cf-files/Makefile b/x11/xorg-cf-files/Makefile
index ea0d9535d93..0b796561174 100644
--- a/x11/xorg-cf-files/Makefile
+++ b/x11/xorg-cf-files/Makefile
@@ -1,8 +1,8 @@
-# $NetBSD: Makefile,v 1.17 2012/01/15 14:01:59 shattered Exp $
+# $NetBSD: Makefile,v 1.18 2012/02/15 15:25:15 hans Exp $
 #
 
 DISTNAME=		xorg-cf-files-1.0.4
-PKGREVISION=		1
+PKGREVISION=		2
 CATEGORIES=		x11 devel
 MASTER_SITES=		${MASTER_SITE_XORG:=util/}
 EXTRACT_SUFX=		.tar.bz2
@@ -25,7 +25,7 @@ post-extract:
 	${CP} ${FILESDIR}/xorgsite.def ${WRKSRC}
 
 pre-configure:
-.for sys in NetBSD FreeBSD DragonFly linux darwin
+.for sys in NetBSD FreeBSD DragonFly linux darwin sun
 	mv ${WRKSRC}/${sys}.cf ${WRKSRC}/${sys}.cf.before && \
 	${SED} -e "s|@@PKGSRC_CC@@|${CC}|g"		\
 		-e "s|@@PKGSRC_CPP@@|${CPP}|g"		\
diff --git a/x11/xorg-cf-files/distinfo b/x11/xorg-cf-files/distinfo
index 344c5efd8d0..a5e68f5d8c0 100644
--- a/x11/xorg-cf-files/distinfo
+++ b/x11/xorg-cf-files/distinfo
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.11 2012/01/15 14:01:59 shattered Exp $
+$NetBSD: distinfo,v 1.12 2012/02/15 15:25:15 hans Exp $
 
 SHA1 (xorg-cf-files-1.0.4.tar.bz2) = c58b7252df481572ec1ccd77b9f1ab561ed89e45
 RMD160 (xorg-cf-files-1.0.4.tar.bz2) = 975942e8974812aae91c45d81eb27522e5aa0a5d
@@ -8,9 +8,10 @@ SHA1 (patch-ab) = f8f816409eb233ae4d8430bd9d43b9bf83c5711d
 SHA1 (patch-ac) = 1f977650d9e903a4ea72afc8541b7649cb989ab8
 SHA1 (patch-ad) = 12c918ad85fa44518525d2c4bc628b342b8c0280
 SHA1 (patch-ae) = b1c870feb6372b8443aac498c24dfa802a536ba2
-SHA1 (patch-af) = bb3ff7952ba3ac24d1eb4165a1d3abc736e77cf7
+SHA1 (patch-af) = e48481afac82cd93e61a1f44dab84876d645ce09
 SHA1 (patch-ag) = 20010c3ade12a6ee07e1093c6143d9600cca3b37
 SHA1 (patch-ah) = f329f44a81c49ba66e8da197ab99a53172a1d247
 SHA1 (patch-ai) = a0795dcd3442471a58c77c667b3eeb50d7bb47bb
 SHA1 (patch-aj) = 6fd05a766895c06b940e28cd5cadde48365790c3
 SHA1 (patch-ak) = ce8c0fa88f6fa4fb1207f95e6e1f3d5ca9018b8c
+SHA1 (patch-sv4Lib.rules) = 20bd05fe6e49cabb74317ded2f4b7565dd45c49d
diff --git a/x11/xorg-cf-files/patches/patch-af b/x11/xorg-cf-files/patches/patch-af
index 140b39e13dc..8471b3dc7fd 100644
--- a/x11/xorg-cf-files/patches/patch-af
+++ b/x11/xorg-cf-files/patches/patch-af
@@ -1,4 +1,4 @@
-$NetBSD: patch-af,v 1.2 2009/02/25 14:20:50 joerg Exp $
+$NetBSD: patch-af,v 1.3 2012/02/15 15:25:15 hans Exp $
 
 Use ginstall on Solaris 11, /usr/ucb/install has been removed.
 
@@ -7,6 +7,8 @@ patch, libraries such as libXext.so will not contain a run-time link path
 to /usr/pkg/xorg/lib, causing run time link failures or possibly linking
 with other (non-Pkgsrc) X libraries on the system!
 
+Use pkgsrc CC, CXX and CFLAGS.
+
 --- sun.cf.orig	2005-12-03 18:20:48.000000000 +0100
 +++ sun.cf
 @@ -429,7 +429,9 @@ XCOMM SunPro C++ CplusplusCompilerMajorV
@@ -20,7 +22,34 @@ with other (non-Pkgsrc) X libraries on the system!
  #  define InstallCmd	    /usr/ucb/install
  # endif
  #ifndef LargefileDefines
-@@ -688,10 +690,10 @@ XCOMM SunPro C++ CplusplusCompilerMajorV
+@@ -669,29 +671,29 @@ XCOMM SunPro C++ CplusplusCompilerMajorV
+ # endif
+ # if HasGcc2
+ #  ifndef CcCmd
+-#   define CcCmd gcc
++#   define CcCmd @@PKGSRC_CC@@
++#  endif
++#  ifndef CppCmd
++#   define CppCmd @@PKGSRC_CPP@@
++#  endif
++#  ifndef CplusplusCmd
++#   define CplusplusCmd @@PKGSRC_CXX@@
+ #  endif
+ #  ifndef AsCmd
+ #   define AsCmd CcCmd -c -x assembler
+ #  endif
+ #  ifndef OptimizedCDebugFlags
+-#   ifdef i386Architecture
+-#    define OptimizedCDebugFlags DefaultGcc2i386Opt
+-#   elif defined(AMD64Architecture)
+-#    define OptimizedCDebugFlags DefaultGcc2AMD64Opt
+-#   else
+-#    define OptimizedCDebugFlags -O2
+-#   endif
++#   define OptimizedCDebugFlags @@PKGSRC_CFLAGS@@
+ #  endif
+ #  if !defined(SharedLibraryLoadFlags) && !defined(SharedLibraryLdCmd)
+ #   if OSMajorVersion == 5 && OSMinorVersion > 6 && defined(i386Architecture)
      /* This is to work around what appears to be a PIC bug in some gcc/egcs
         versions that shows up with the Solaris 7/x86 <ctype.h>. */
  #    define SharedLibraryLdCmd $(LD)
diff --git a/x11/xorg-cf-files/patches/patch-sv4Lib.rules b/x11/xorg-cf-files/patches/patch-sv4Lib.rules
new file mode 100644
index 00000000000..503c4da9d90
--- /dev/null
+++ b/x11/xorg-cf-files/patches/patch-sv4Lib.rules
@@ -0,0 +1,63 @@
+$NetBSD: patch-sv4Lib.rules,v 1.1 2012/02/15 15:25:15 hans Exp $
+
+--- sv4Lib.rules.orig	2009-10-16 23:45:42.000000000 +0200
++++ sv4Lib.rules	2012-01-15 22:45:33.359398571 +0100
+@@ -63,26 +63,50 @@ XCOMM $XFree86: xc/config/cf/sv4Lib.rule
+ /*
+  * InstallSharedLibrary - generate rules to install the shared library.
+  */
++INSTALLMINORREV = true
++
+ #ifndef InstallSharedLibrary
+ #if StripInstalledPrograms
+ # define InstallSharedLibrary(libname,rev,dest)				@@\
+ install:: Concat(lib,libname.so.rev) 					@@\
+ 	MakeDir($(DESTDIR)dest)						@@\
+-	$(INSTALL) $(INSTALLFLAGS) $(INSTLIBFLAGS) Concat(lib,libname.so.rev) $(DESTDIR)dest @@\
++	T=`echo Concat(lib,libname.so.rev) | sed 's/\(lib[^\.]*\.so\.[0-9]*\)\(\.[0-9]*\)\{1,2\}/\1/'`;\	@@\
++	if $(INSTALLMINORREV); then \					@@\
++	  INST=Concat(lib,libname.so.rev); \				@@\
++	  LINK=$$T; \							@@\
++	else \								@@\
++	  INST=$$T; \							@@\
++	fi; \								@@\
++	(set -x; \							@@\
++	$(INSTALL) $(INSTALLFLAGS) $(INSTBINFLAGS) $$INST $(DESTDIR)dest); \ @@\
+ 	mcs -d Concat($(DESTDIR)dest/lib,libname.so.rev)		@@\
+-	@if $(SOSYMLINK); then (set -x; \				@@\
++	if [ X"$$LINK" != X ]; then (set -x; \				@@\
++	  $(RM) $(DESTDIR)dest/$$LINK; \				@@\
++	  $(LN) $$INST $(DESTDIR)dest/$$LINK); \			@@\
++	fi; \								@@\
++	if $(SOSYMLINK); then (set -x; \				@@\
+ 	  $(RM) Concat($(DESTDIR)dest/lib,libname.so); \		@@\
+-	  cd $(DESTDIR)dest; \						@@\
+-	  $(LN) Concat(lib,libname.so.rev) Concat(lib,libname.so)); fi
++	  $(LN) $$T Concat($(DESTDIR)dest/lib,libname.so)); fi
+ #else
+ # define InstallSharedLibrary(libname,rev,dest)				@@\
+ install:: Concat(lib,libname.so.rev) 					@@\
+ 	MakeDir($(DESTDIR)dest)						@@\
+-	$(INSTALL) $(INSTALLFLAGS) $(INSTLIBFLAGS) Concat(lib,libname.so.rev) $(DESTDIR)dest @@\
+-	@if $(SOSYMLINK); then (set -x; \				@@\
++	T=`echo Concat(lib,libname.so.rev) | sed 's/\(lib[^\.]*\.so\.[0-9]*\)\(\.[0-9]*\)\{1,2\}/\1/'`;\	@@\
++	if $(INSTALLMINORREV); then \					@@\
++	  INST=Concat(lib,libname.so.rev); \				@@\
++	  LINK=$$T; \							@@\
++	else \								@@\
++	  INST=$$T; \							@@\
++	fi; \								@@\
++	(set -x; \							@@\
++	$(INSTALL) $(INSTALLFLAGS) $(INSTBINFLAGS) $$INST $(DESTDIR)dest); \ @@\
++	if [ X"$$LINK" != X ]; then (set -x; \				@@\
++	  $(RM) $(DESTDIR)dest/$$LINK; \				@@\
++	  $(LN) $$INST $(DESTDIR)dest/$$LINK); \			@@\
++	fi; \								@@\
++	if $(SOSYMLINK); then (set -x; \				@@\
+ 	  $(RM) Concat($(DESTDIR)dest/lib,libname.so); \		@@\
+-	  cd $(DESTDIR)dest; \						@@\
+-	  $(LN) Concat(lib,libname.so.rev) Concat(lib,libname.so)); fi
++	  $(LN) $$T Concat($(DESTDIR)dest/lib,libname.so)); fi
+ #endif
+ 
+ #endif /* InstallSharedLibrary */
-- 
cgit v1.2.3