From: Shlomi Fish Date: Sat, 25 Mar 2017 12:39:30 +0000 (+0300) Subject: Add support for installing the offensive forts. X-Git-Tag: fortune-mod-1.99.5~2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=99d4ee96341097d446aa921944e13b233ebf2785;p=fortune-mod Add support for installing the offensive forts. Using cmake. --- diff --git a/fortune-mod/CMakeLists.txt b/fortune-mod/CMakeLists.txt index 9b7538f..3789c39 100644 --- a/fortune-mod/CMakeLists.txt +++ b/fortune-mod/CMakeLists.txt @@ -211,6 +211,34 @@ SET (COOKIES debian ) +SET (OFFENSIVE_COOKIES + art + astrology + atheism + black-humor + cookie + debian + definitions + drugs + ethnic + fortunes + hphobia + limerick + linux + misandry + miscellaneous + misogyny + politics + privates + racism + religion + riddles + sex + songs-poems + vulgarity + zippy +) + ADD_SUBDIRECTORY("datfiles") string (REPLACE ";" " " COOKIES_STR "${COOKIES}") diff --git a/fortune-mod/datfiles/CMakeLists.txt b/fortune-mod/datfiles/CMakeLists.txt index fcfe9d6..092e661 100644 --- a/fortune-mod/datfiles/CMakeLists.txt +++ b/fortune-mod/datfiles/CMakeLists.txt @@ -41,3 +41,6 @@ FOREACH(c ${COOKIES}) ) ENDFOREACH() +IF (NOT "${NO_OFFENSIVE}") + ADD_SUBDIRECTORY("off") +ENDIF() diff --git a/fortune-mod/datfiles/off/CMakeLists.txt b/fortune-mod/datfiles/off/CMakeLists.txt new file mode 100644 index 0000000..112167e --- /dev/null +++ b/fortune-mod/datfiles/off/CMakeLists.txt @@ -0,0 +1,45 @@ +SET (_strfile "${CMAKE_CURRENT_BINARY_DIR}/../../strfile") +SET (_rot "${CMAKE_CURRENT_BINARY_DIR}/../../rot") +SET (rot_dir "${CMAKE_CURRENT_BINARY_DIR}/rotated") +FILE(MAKE_DIRECTORY "${rot_dir}") +FOREACH(c ${OFFENSIVE_COOKIES}) + SET(TARGET_NAME "offensive_cookie__${c}") + SET(rot_dest "${rot_dir}/${c}") + SET(DEST "${c}.dat") + SET(SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/unrotated/${c}") + + SET(PATH_PERL ${PERL_EXECUTABLE}) + ADD_CUSTOM_COMMAND( + OUTPUT "${rot_dest}" + COMMAND "${_rot}" + ARGS "<" "${SOURCE}" ">" "${rot_dest}" + DEPENDS "${SOURCE}" "${_rot}" + ) + ADD_CUSTOM_COMMAND( + OUTPUT "${DEST}" + COMMAND "${_strfile}" + ARGS "${rot_dest}" "${DEST}" + DEPENDS "${rot_dest}" "${_strfile}" + ) + + SET(LINK "${c}.u8") + SET(rot_LINK "${rot_dir}/${LINK}") + ADD_CUSTOM_COMMAND( + OUTPUT "${rot_LINK}" + COMMAND "ln" + ARGS "-s" "${c}" "${LINK}" + DEPENDS "${rot_dest}" + WORKING_DIRECTORY "${rot_dir}" + ) + + ADD_CUSTOM_TARGET( + "${TARGET_NAME}" ALL + DEPENDS "${rot_dest}" "${DEST}" "${rot_LINK}" + ) + + INSTALL( + FILES "${rot_dest}" "${CMAKE_CURRENT_BINARY_DIR}/${DEST}" "${rot_LINK}" + DESTINATION "share/games/fortunes/off" + ) + +ENDFOREACH()