]> granicus.if.org Git - fortune-mod/commitdiff
Add support for installing the offensive forts.
authorShlomi Fish <shlomif@shlomifish.org>
Sat, 25 Mar 2017 12:39:30 +0000 (15:39 +0300)
committerShlomi Fish <shlomif@shlomifish.org>
Sat, 25 Mar 2017 12:39:30 +0000 (15:39 +0300)
Using cmake.

fortune-mod/CMakeLists.txt
fortune-mod/datfiles/CMakeLists.txt
fortune-mod/datfiles/off/CMakeLists.txt [new file with mode: 0644]

index 9b7538ff7f192416e87b403bf198c2657b192b02..3789c39877be82457ee08d0e3d23f8d83a597e29 100644 (file)
@@ -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}")
index fcfe9d64c8b10442bb9e955e1a8aca604916a306..092e661f8432b462935fcb843e27bd3db5d8547e 100644 (file)
@@ -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 (file)
index 0000000..112167e
--- /dev/null
@@ -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()