pkgsrc-Changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
CVS commit: pkgsrc/devel/cmake
Module Name: pkgsrc
Committed By: chuck
Date: Sun Apr 8 19:09:46 UTC 2018
Modified Files:
pkgsrc/devel/cmake: Makefile distinfo
Added Files:
pkgsrc/devel/cmake/patches: patch-Modules_Compiler_GNU.cmake
Log Message:
add CMAKE_PKGSRC_BUILD_FLAGS for pkgsrc build to set opts
With pkgsrc built packages, the goal is to have the user's compiler
optimization flags set by the user using CFLAGS, etc. To that end,
the cmake Makefile has subst.mk code to "sed -e 's,-O.,,'" out opt.
flags in Modules/Compiler/*.cmake for cmake compiles with the
CMAKE_BUILD_TYPE set (e.g. to Release).
Unfortunately, this sed-based approach has two drawbacks: First, it
gets applied to packages build with cmake outside of pkgsrc (changing
the semantics of -DCMAKE_BUILD_TYPE=Release in an unexpected way by
remove -O flags from it). Second, the sed expression damages some
of the Modules/Compiler/*.cmake as not all opt flags match the "-O."
regular expression.
To address this we:
1. remove the subst.mk sed operation on Modules/Compiler/*.cmake
2. add a new config variable CMAKE_PKGSRC_BUILD_FLAGS that should
be set for pkgsrc-based cmake builds (e.g. in mk/configure/cmake.mk)
3. we add a patch for Modules/Compiler/GNU.cmake to look for
CMAKE_PKGSRC_BUILD_FLAGS and choose a set of non-opt compiler
flags when this is set (to provide the desired behavior under pksrc).
note that the GNU.cmake file is also used by clang. We can
make the corresponding changes to other compilers if desired.
The result is that cmake compiles under pkgsrc set CMAKE_PKGSRC_BUILD_FLAGS
and follow CFLAGS, etc. (bypassing CMAKE_BUILD_TYPE), but cmake compiles
outside of pkgsrc follow the standard cmake semantics for CMAKE_BUILD_TYPE.
Also, we no longer damage Modules/Compiler/*.cmake with sed.
To generate a diff of this commit:
cvs rdiff -u -r1.141 -r1.142 pkgsrc/devel/cmake/Makefile
cvs rdiff -u -r1.115 -r1.116 pkgsrc/devel/cmake/distinfo
cvs rdiff -u -r0 -r1.1 \
pkgsrc/devel/cmake/patches/patch-Modules_Compiler_GNU.cmake
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: pkgsrc/devel/cmake/Makefile
diff -u pkgsrc/devel/cmake/Makefile:1.141 pkgsrc/devel/cmake/Makefile:1.142
--- pkgsrc/devel/cmake/Makefile:1.141 Mon Apr 2 19:36:44 2018
+++ pkgsrc/devel/cmake/Makefile Sun Apr 8 19:09:45 2018
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.141 2018/04/02 19:36:44 adam Exp $
+# $NetBSD: Makefile,v 1.142 2018/04/08 19:09:45 chuck Exp $
.include "Makefile.version"
@@ -51,14 +51,8 @@ SUBST_FILES.cmake+= Modules/FindX11.cmak
SUBST_FILES.cmake+= Modules/Platform/UnixPaths.cmake
SUBST_VARS.cmake= LOCALBASE X11BASE
-SUBST_CLASSES+= flags
-SUBST_STAGE.flags= pre-configure
-SUBST_MESSAGE.flags= Fixing compiler flags.
-SUBST_FILES.flags= Modules/Compiler/*.cmake
-SUBST_SED.flags= -e 's,-O.,,'
-
pre-configure:
- ${RM} -f ${WRKSRC}/Modules/*.orig ${WRKSRC}/Modules/Platform/*.orig
+ ${RM} -f ${WRKSRC}/Modules/*.orig ${WRKSRC}/Modules/Compiler/*.orig ${WRKSRC}/Modules/Platform/*.orig
${LN} -f ${WRKSRC}/Modules/Platform/OpenBSD.cmake ${WRKSRC}/Modules/Platform/MirBSD.cmake
.for lang in C CXX Fortran
${LN} -f ${WRKSRC}/Modules/Platform/SunOS-GNU-${lang}.cmake \
Index: pkgsrc/devel/cmake/distinfo
diff -u pkgsrc/devel/cmake/distinfo:1.115 pkgsrc/devel/cmake/distinfo:1.116
--- pkgsrc/devel/cmake/distinfo:1.115 Mon Apr 2 19:36:44 2018
+++ pkgsrc/devel/cmake/distinfo Sun Apr 8 19:09:45 2018
@@ -1,10 +1,11 @@
-$NetBSD: distinfo,v 1.115 2018/04/02 19:36:44 adam Exp $
+$NetBSD: distinfo,v 1.116 2018/04/08 19:09:45 chuck Exp $
SHA1 (cmake-3.11.0.tar.gz) = 7851f87185f80e260ea634d5985ec9215fe408c8
RMD160 (cmake-3.11.0.tar.gz) = 66ae49e6e10679dd56aa05269a6321b9269a5cd5
SHA512 (cmake-3.11.0.tar.gz) = 03b058483d236d4f4427c93cc41af77068c243fc4b6f24aeaf2daf97af215bc664bc1b733195463af4cfc94ec70076710f425661859d752ddf3b9610adca9834
Size (cmake-3.11.0.tar.gz) = 7948287 bytes
SHA1 (patch-CMakeLists.txt) = a0b03f2fad5ea174095c4fe52cea67d94cf46e2d
+SHA1 (patch-Modules_Compiler_GNU.cmake) = e091c53ac3f3a6cd811119d3231563df32e76bf9
SHA1 (patch-Modules_FindCurses.cmake) = 09fcd7adfbc2dfc2cd8af4e047d870a5243d77dc
SHA1 (patch-Modules_FindPythonInterp.cmake) = d1b39bdcd654f2a4fc63463cd20de656cce3cf8f
SHA1 (patch-Modules_FindPythonLibs.cmake) = b5cedc6a2354beaf08e06d416c150154a7dc1f05
Added files:
Index: pkgsrc/devel/cmake/patches/patch-Modules_Compiler_GNU.cmake
diff -u /dev/null pkgsrc/devel/cmake/patches/patch-Modules_Compiler_GNU.cmake:1.1
--- /dev/null Sun Apr 8 19:09:46 2018
+++ pkgsrc/devel/cmake/patches/patch-Modules_Compiler_GNU.cmake Sun Apr 8 19:09:46 2018
@@ -0,0 +1,27 @@
+$NetBSD: patch-Modules_Compiler_GNU.cmake,v 1.1 2018/04/08 19:09:46 chuck Exp $
+
+Add CMAKE_PKGSRC_BUILD_FLAGS to allow pkgsrc-based builds to set
+compiler optimizer flags (overrides CMAKE_BUILD_TYPE). Also enabled
+for CMAKE_BOOTSTRAP so it is applied to the build of cmake itself.
+
+--- Modules/Compiler/GNU.cmake.orig 2018-03-16 07:16:31.000000000 -0400
++++ Modules/Compiler/GNU.cmake 2018-04-07 16:23:51.000000000 -0400
+@@ -39,9 +39,15 @@
+ # Initial configuration flags.
+ string(APPEND CMAKE_${lang}_FLAGS_INIT " ")
+ string(APPEND CMAKE_${lang}_FLAGS_DEBUG_INIT " -g")
+- string(APPEND CMAKE_${lang}_FLAGS_MINSIZEREL_INIT " -Os -DNDEBUG")
+- string(APPEND CMAKE_${lang}_FLAGS_RELEASE_INIT " -O3 -DNDEBUG")
+- string(APPEND CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT " -O2 -g -DNDEBUG")
++ if(CMAKE_BOOTSTRAP OR CMAKE_PKGSRC_BUILD_FLAGS)
++ string(APPEND CMAKE_${lang}_FLAGS_MINSIZEREL_INIT " -DNDEBUG")
++ string(APPEND CMAKE_${lang}_FLAGS_RELEASE_INIT " -DNDEBUG")
++ string(APPEND CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT " -g -DNDEBUG")
++ else()
++ string(APPEND CMAKE_${lang}_FLAGS_MINSIZEREL_INIT " -Os -DNDEBUG")
++ string(APPEND CMAKE_${lang}_FLAGS_RELEASE_INIT " -O3 -DNDEBUG")
++ string(APPEND CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT " -O2 -g -DNDEBUG")
++ endif()
+ set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE "<CMAKE_${lang}_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")
+ set(CMAKE_${lang}_CREATE_ASSEMBLY_SOURCE "<CMAKE_${lang}_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>")
+ if(NOT APPLE OR NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 4) # work around #4462
Home |
Main Index |
Thread Index |
Old Index