From: Shlomi Fish Date: Tue, 14 Dec 2021 13:48:36 +0000 (+0200) Subject: try2fix crosscompiling builds + cmake fixes X-Git-Tag: fortune-mod-3.10.0~7 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d7e56c480859efbde2b498a7b150ca29b6ffa24a;p=fortune-mod try2fix crosscompiling builds + cmake fixes See: https://github.com/shlomif/fortune-mod/issues/58 Thanks to https://github.com/leleliu008 --- diff --git a/fortune-mod/CMakeLists.txt b/fortune-mod/CMakeLists.txt index c6b9941..a00f887 100644 --- a/fortune-mod/CMakeLists.txt +++ b/fortune-mod/CMakeLists.txt @@ -109,7 +109,7 @@ INCLUDE ("${CMAKE_SOURCE_DIR}/cmake/rinutils_bootstrap.cmake") RINUTILS_SET_UP_FLAGS() -IF ("$ENV{FCS_GCC}") +IF (ENV{FCS_GCC}) ADD_DEFINITIONS("-W -Wabi=11 -Waddress -Waggressive-loop-optimizations -Wall -Wattributes -Wbad-function-cast -Wbool-compare -Wbool-operation -Wbuiltin-declaration-mismatch -Wbuiltin-macro-redefined -Wcast-align -Wchar-subscripts -Wclobbered -Wcomment -Wcomments -Wcoverage-mismatch -Wcpp -Wdangling-else -Wdate-time -Wdeprecated -Wdeprecated-declarations -Wdesignated-init -Wdisabled-optimization -Wdiscarded-array-qualifiers -Wdiscarded-qualifiers -Wdiv-by-zero -Wdouble-promotion -Wduplicated-branches -Wduplicated-cond -Wduplicate-decl-specifier -Wempty-body -Wendif-labels -Wenum-compare -Wexpansion-to-defined -Wextra -Wformat-contains-nul -Wformat-extra-args -Wformat-nonliteral -Wformat-security -Wformat-signedness -Wformat-y2k -Wformat-zero-length -Wframe-address -Wfree-nonheap-object -Whsa -Wignored-attributes -Wignored-qualifiers -Wimplicit -Wimplicit-function-declaration -Wimplicit-int -Wincompatible-pointer-types -Winit-self -Winline -Wint-conversion -Wint-in-bool-context -Wint-to-pointer-cast -Winvalid-memory-model -Winvalid-pch -Wjump-misses-init -Wlogical-not-parentheses -Wlogical-op -Wmain -Wmaybe-uninitialized -Wmemset-elt-size -Wmemset-transposed-args -Wmisleading-indentation -Wmissing-braces -Wmissing-declarations -Wmissing-field-initializers -Wmissing-include-dirs -Wmissing-parameter-type -Wmissing-prototypes -Wmultichar -Wnarrowing -Wnested-externs -Wnonnull -Wnonnull-compare -Wnull-dereference -Wodr -Wold-style-declaration -Wold-style-definition -Wopenmp-simd -Woverflow -Woverlength-strings -Woverride-init -Wpacked -Wpacked-bitfield-compat -Wparentheses -Wpointer-arith -Wpointer-compare -Wpointer-sign -Wpointer-to-int-cast -Wpragmas -Wpsabi -Wrestrict -Wreturn-local-addr -Wreturn-type -Wscalar-storage-order -Wsequence-point -Wshadow -Wshift-count-negative -Wshift-count-overflow -Wshift-negative-value -Wsizeof-array-argument -Wsizeof-pointer-memaccess -Wstack-protector -Wstrict-aliasing -Wstrict-prototypes -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wsuggest-attribute=pure -Wsuggest-final-methods -Wsuggest-final-types -Wswitch -Wswitch-bool -Wswitch-default -Wswitch-unreachable -Wsync-nand -Wtautological-compare -Wtrampolines -Wtrigraphs -Wtype-limits -Wuninitialized -Wunknown-pragmas -Wunsafe-loop-optimizations -Wunused -Wunused-but-set-parameter -Wunused-but-set-variable -Wunused-function -Wunused-label -Wunused-local-typedefs -Wunused-macros -Wunused-parameter -Wunused-result -Wunused-value -Wunused-variable -Wvarargs -Wvariadic-macros -Wvector-operation-performance -Wvla -Wvolatile-register-var -Wwrite-strings -Walloc-size-larger-than=9223372036854775807 -Warray-bounds=2 -Wformat-overflow=2 -Wformat-truncation=2 -Wnormalized=nfc -Wshift-overflow=2 -Wunused-const-variable=2 -Wstrict-overflow=1 -Wno-switch-default -Wno-vla -Wno-inline -Wno-jump-misses-init -Wno-unsafe-loop-optimizations") # -Wimplicit-fallthrough=5 # -Wno-vla-larger-than @@ -131,7 +131,7 @@ INCLUDE(CheckIncludeFile) INCLUDE(CheckIncludeFiles) SET(_r "stdbool.h" "stdio.h" "recode.h") CHECK_INCLUDE_FILES("${_r}" HAVE_RECODE_H) -IF (NOT "${HAVE_RECODE_H}") +IF (NOT HAVE_RECODE_H) IF (NOT WIN32) MESSAGE(WARNING "Cannot find recode.h anywhere; it is usually unnecessary, but you may opt to install a source release tarball of the recode library from https://github.com/rrthomas/recode") ENDIF () @@ -193,7 +193,7 @@ SET (_my_man_page "${_my_man_page_dir}/fortune.6") SET (_my_man_gen "${CMAKE_CURRENT_SOURCE_DIR}/fortune/process-fortune-man-template.pl") SET (_my_args) LIST(APPEND _my_args "--cookiedir" "${COOKIEDIR}" "--ocookiedir" "${OCOOKIEDIR}" "--output" "${_my_man_page}") -IF ("${NO_OFFENSIVE}") +IF (NO_OFFENSIVE) LIST(APPEND _my_args "--without-offensive") SET(_MY_IN "${CMAKE_CURRENT_SOURCE_DIR}/fortune/fortune_with_offensive.template.man") ELSE() @@ -277,13 +277,13 @@ IF(WIN32 AND NOT UNIX) ENDFOREACH() ENDIF() -IF ("${NO_OFFENSIVE}") +IF (NO_OFFENSIVE) ADD_DEFINITIONS("-DNO_OFFENSIVE=1") ENDIF() CHECK_INCLUDE_FILE("regex.h" HAVE_REGEX_H) -IF ("${HAVE_REGEX_H}") +IF (HAVE_REGEX_H) ADD_DEFINITIONS("-DHAVE_REGEX_H") ADD_DEFINITIONS("-DPOSIX_REGEX") ENDIF() diff --git a/fortune-mod/datfiles/CMakeLists.txt b/fortune-mod/datfiles/CMakeLists.txt index 52cbfc2..b012130 100644 --- a/fortune-mod/datfiles/CMakeLists.txt +++ b/fortune-mod/datfiles/CMakeLists.txt @@ -1,8 +1,8 @@ # See: https://github.com/shlomif/fortune-mod/issues/58 -if ("${IS_CROSS}") +if (IS_CROSS) SET (_strfile "strfile") find_program(_found "${_strfile}") - if (NOT "${_found}") + if (NOT _found) MESSAGE(FATAL_ERROR "\"strfile\" must be in the executables' path for cross-compiling builds. You can get it from a native install of fortune-mod: https://superuser.com/questions/284342/what-are-path-and-other-environment-variables-and-how-can-i-set-or-use-them . Also see https://github.com/shlomif/fortune-mod/issues/58 .") endif() else() @@ -61,6 +61,6 @@ INSTALL( DESTINATION "${LOCALDIR}" ) -IF (NOT "${NO_OFFENSIVE}") +IF (NOT NO_OFFENSIVE) ADD_SUBDIRECTORY("off") ENDIF() diff --git a/fortune-mod/datfiles/off/CMakeLists.txt b/fortune-mod/datfiles/off/CMakeLists.txt index 25b29dd..8a87044 100644 --- a/fortune-mod/datfiles/off/CMakeLists.txt +++ b/fortune-mod/datfiles/off/CMakeLists.txt @@ -1,6 +1,6 @@ # See: https://github.com/shlomif/fortune-mod/issues/58 SET (_target_rot "${CMAKE_CURRENT_BINARY_DIR}/../../rot") -if ("${IS_CROSS}") +if (IS_CROSS) SET (_rot ${PERL_EXECUTABLE} "${CMAKE_CURRENT_SOURCE_DIR}/../../util/rot.pl") else() SET (_rot "${_target_rot}") @@ -30,11 +30,11 @@ FOREACH(c ${OFFENSIVE_COOKIES}) SET(LINK "${c}.u8") SET(rot_LINK "${rot_dir}/${LINK}") if (WIN32) - ADD_CUSTOM_COMMAND( - OUTPUT "${rot_LINK}" - COMMAND ${CMAKE_COMMAND} -E copy "${rot_dest}" "${rot_LINK}" - DEPENDS "${rot_dest}" - ) + ADD_CUSTOM_COMMAND( + OUTPUT "${rot_LINK}" + COMMAND ${CMAKE_COMMAND} -E copy "${rot_dest}" "${rot_LINK}" + DEPENDS "${rot_dest}" + ) else() ADD_CUSTOM_COMMAND( OUTPUT "${rot_LINK}"