aboutsummaryrefslogtreecommitdiffstats
path: root/textproc/ctpp2
diff options
context:
space:
mode:
authorglarkin <glarkin@FreeBSD.org>2008-09-07 08:19:53 +0800
committerglarkin <glarkin@FreeBSD.org>2008-09-07 08:19:53 +0800
commit43ea40745752c821a9bbd7f0a29bc8da82a613df (patch)
tree0e13934827eb94d6f39bdf534df3f6e2b3b68cfe /textproc/ctpp2
parent027499f127dc5ba8742e509578d1e26d3baaa6d9 (diff)
downloadfreebsd-ports-gnome-43ea40745752c821a9bbd7f0a29bc8da82a613df.tar.gz
freebsd-ports-gnome-43ea40745752c821a9bbd7f0a29bc8da82a613df.tar.zst
freebsd-ports-gnome-43ea40745752c821a9bbd7f0a29bc8da82a613df.zip
- Fixed handling of GCC -mtune switch on various combinations
of ARCH and OSVERSION Reported by: pointyhat Approved by: beech, itetcu (mentors, implicit)
Diffstat (limited to 'textproc/ctpp2')
-rw-r--r--textproc/ctpp2/Makefile47
-rw-r--r--textproc/ctpp2/files/extra-patch-CMakeLists.txt11
-rw-r--r--textproc/ctpp2/files/patch-CMakeLists.txt.in (renamed from textproc/ctpp2/files/patch-CMakeLists.txt)2
3 files changed, 58 insertions, 2 deletions
diff --git a/textproc/ctpp2/Makefile b/textproc/ctpp2/Makefile
index 1df3f7c6bfb0..e31719862a4f 100644
--- a/textproc/ctpp2/Makefile
+++ b/textproc/ctpp2/Makefile
@@ -7,6 +7,7 @@
PORTNAME= ctpp2
PORTVERSION= 2.3.5
+PORTREVISION= 1
CATEGORIES= textproc devel
MASTER_SITES= http://ctpp.havoc.ru/download/ \
LOCAL/glarkin
@@ -16,5 +17,49 @@ COMMENT= C++ library to use templates in C/C++ projects, version 2
USE_CMAKE= yes
USE_LDCONFIG= yes
+USE_GETTEXT= yes
+USE_ICONV= yes
-.include <bsd.port.mk>
+.include <bsd.port.pre.mk>
+
+# Let me explain - GCC 3.4 does not support -mtune=generic, so
+# TUNE_PARAM is set to the platform-specific value. If the platform
+# is not i386 nor amd64, just disable -mtune altogether.
+#
+# If the system GCC 4.2+, simply use -mtune=generic for i386 and
+# amd64. Once again, disable -mtune for other platforms.
+.if ${OSVERSION} < 700042
+. if ${ARCH} == "i386"
+TUNE_PARAM=i686
+HASHMARK=
+. elif ${ARCH} == "amd64"
+TUNE_PARAM=athlon64
+HASHMARK=
+. else
+TUNE_PARAM=
+HASHMARK=\#
+. endif
+.else
+. if ${ARCH} == "i386" || ${ARCH} == "amd64"
+TUNE_PARAM=generic
+HASHMARK=
+. else
+TUNE_PARAM=
+HASHMARK=\#
+. endif
+.endif
+
+#
+# This is not ideal, but because of the way CMakeLists.txt is structured,
+# I have to apply a 2nd patch if -mtune is not used at all (non-i386 and
+# non-amd64 arch).
+#
+.if ${TUNE_PARAM} == ""
+EXTRA_PATCHES+= ${FILESDIR}/extra-patch-CMakeLists.txt
+.endif
+
+post-patch:
+ @${REINPLACE_CMD} -e 's,%%TUNE_PARAM%%,${TUNE_PARAM},' \
+ -e 's,%%HASHMARK%%,${HASHMARK},' ${WRKSRC}/CMakeLists.txt
+
+.include <bsd.port.post.mk>
diff --git a/textproc/ctpp2/files/extra-patch-CMakeLists.txt b/textproc/ctpp2/files/extra-patch-CMakeLists.txt
new file mode 100644
index 000000000000..282ba0b21e5a
--- /dev/null
+++ b/textproc/ctpp2/files/extra-patch-CMakeLists.txt
@@ -0,0 +1,11 @@
+--- ./CMakeLists.txt.orig 2008-09-04 17:53:59.000000000 -0400
++++ ./CMakeLists.txt 2008-09-04 17:54:12.000000000 -0400
+@@ -311,7 +311,7 @@
+ SET(CMAKE_CXX_WARN_FLAGS " -Wall -pedantic -Wno-long-long -Winline -finline-functions ")
+
+ IF(ENABLE_OPTIMIZATION MATCHES "ON")
+- SET(CMAKE_CXX_FLAGS "${CXX_FLAGS} ${CMAKE_CXX_WARN_FLAGS} ${CMAKE_CXX_PARAMS} -mtune=${CPU_TUNE} -O3 -funroll-loops ")
++ SET(CMAKE_CXX_FLAGS "${CXX_FLAGS} ${CMAKE_CXX_WARN_FLAGS} ${CMAKE_CXX_PARAMS} -O3 -funroll-loops ")
+ ELSE(ENABLE_OPTIMIZATION MATCHES "OFF")
+ SET(CMAKE_CXX_FLAGS "${CXX_FLAGS} ${CMAKE_CXX_WARN_FLAGS} ${CMAKE_CXX_PARAMS} ")
+ ENDIF(ENABLE_OPTIMIZATION MATCHES "ON")
diff --git a/textproc/ctpp2/files/patch-CMakeLists.txt b/textproc/ctpp2/files/patch-CMakeLists.txt.in
index 19236d8703d9..b491ce252ab2 100644
--- a/textproc/ctpp2/files/patch-CMakeLists.txt
+++ b/textproc/ctpp2/files/patch-CMakeLists.txt.in
@@ -5,7 +5,7 @@
# uild optimized code for following CPU (default i386)
-SET(CPU_TUNE "i686")
-+SET(CPU_TUNE "generic")
++%%HASHMARK%%SET(CPU_TUNE "%%TUNE_PARAM%%")
SET(CTPP_FLOAT_PRECISION 12)