diff --git a/debian/changelog b/debian/changelog index 4241ca212..bd1a0bbfe 100644 --- a/debian/changelog +++ b/debian/changelog @@ -22,6 +22,7 @@ cmake (2.8.4-1) UNRELEASED; urgency=low [ Modestas Vainius ] * Disable git-import-orig in debian/watch. One extra command is not a good enough reason to lose control of packaging to non-trivial black-box tools. + * Use less error-prone way of setting build flags. -- Kai Wasserbäch Sun, 16 Jan 2011 11:40:34 +0100 diff --git a/debian/rules b/debian/rules index b3716d939..fa3dde2b0 100755 --- a/debian/rules +++ b/debian/rules @@ -1,25 +1,30 @@ #!/usr/bin/make -f BUILD_FLAGS_FILE = build-flags.cmake +set_build_flag = echo 'set($(1) $(2) CACHE \ + $(if $(filter $(2),YES ON TRUE NO OFF FALSE),BOOL,STRING) \ + $(or $(3),"") FORCE)' >> $(BUILD_FLAGS_FILE) $(BUILD_FLAGS_FILE): touch $@ - echo 'set(CMAKE_SKIP_RPATH YES CACHE BOOL "Skip rpath" FORCE)' >> $@ - echo 'set(CMAKE_USE_RELATIVE_PATHS YES CACHE BOOL "Use relative paths" FORCE)' >> $@ - echo 'set(CMAKE_VERBOSE_MAKEFILE ON CACHE BOOL "Verbose build" FORCE)' >> $@ - echo 'set(CMAKE_C_FLAGS "$(CFLAGS)" CACHE STRING "C flags" FORCE)' >> $@ - echo 'set(CMAKE_CXX_FLAGS "$(CFLAGS)" CACHE STRING "C++ flags" FORCE)' >> $@ - echo 'set(CMAKE_SKIP_BOOTSTRAP_TEST ON CACHE BOOL "Skip BootstrapTest" FORCE)' >> $@ -# echo 'set(BUILD_WXDialog ON CACHE STRING "Build WXDialog" FORCE)' >> $@ - echo 'set(BUILD_CursesDialog TRUE CACHE BOOL "Build curses GUI" FORCE)' >> $@ - echo 'set(BUILD_QtDialog TRUE CACHE BOOL "Build Qt4 GUI" FORCE)' >> $@ - echo 'set(MINGW_CC_LINUX2WIN_EXECUTABLE "" CACHE FILEPATH "Never detect mingw" FORCE)' >> $@ -# echo 'set(TARGET_VERSION CACHE STRING ""FORCE)' >> $@ -# echo 'set(TARGET_SOVERSION CACHE STRING "" FORCE)' >> $@ -# echo 'set(BUILD_DOCUMENTATION ON CACHE BOOL "" FORCE)' >> $@ -# echo 'set(BUILD_DOXYGEN ON CACHE BOOL "" FORCE)' >> $@ - echo 'set(CMAKE_USE_SYSTEM_LIBARCHIVE YES CACHE BOOL "" FORCE)' >> $@ - echo 'set(CTEST_USE_XMLRPC YES CACHE BOOL "" FORCE)' >> $@ + $(call $(flag_action),CMAKE_SKIP_RPATH,ON,"Skip rpath") + $(call $(flag_action),CMAKE_USE_RELATIVE_PATHS,ON,"Use relative paths") + $(call $(flag_action),CMAKE_VERBOSE_MAKEFILE,ON,"Verbose build") + $(call $(flag_action),CMAKE_C_FLAGS,"$(CFLAGS)","C flags") + $(call $(flag_action),CMAKE_CXX_FLAGS,"$(CFLAGS)","C++ flags") + $(call $(flag_action),CMAKE_SKIP_BOOTSTRAP_TEST,ON,"Skip BootstrapTest") + $(call $(flag_action),BUILD_WXDialog,ON,"Build WXDialog") + $(call $(flag_action),BUILD_CursesDialog,ON,"Build curses GUI") + $(call $(flag_action),BUILD_QtDialog,ON,"Build Qt4 GUI") + $(call $(flag_action),MINGW_CC_LINUX2WIN_EXECUTABLE,"","Never detect mingw") +# $(call $(flag_action),TARGET_VERSION) +# $(call $(flag_action),TARGET_SOVERSION) +# $(call $(flag_action),BUILD_DOCUMENTATION,ON) +# $(call $(flag_action),BUILD_DOXYGEN,ON) + $(call $(flag_action),CMAKE_USE_SYSTEM_LIBARCHIVE,ON) + $(call $(flag_action),CTEST_USE_XMLRPC,ON) + +$(BUILD_FLAGS_FILE): flag_action := set_build_flag override_dh_auto_configure: $(BUILD_FLAGS_FILE) rm -rf Build && mkdir -p Build