- Fixed handling of GCC -mtune switch on various combinations
of ARCH and OSVERSION Reported by: pointyhat Approved by: beech, itetcu (mentors, implicit)
This commit is contained in:
parent
d72c560b21
commit
d9669e98a8
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=220032
3 changed files with 58 additions and 2 deletions
|
@ -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>
|
||||
|
|
11
textproc/ctpp2/files/extra-patch-CMakeLists.txt
Normal file
11
textproc/ctpp2/files/extra-patch-CMakeLists.txt
Normal file
|
@ -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")
|
|
@ -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)
|
||||
|
Loading…
Reference in a new issue