]> granicus.if.org Git - fortune-mod/commitdiff
try to fix crosscompiling builds
authorShlomi Fish <shlomif@shlomifish.org>
Tue, 14 Dec 2021 08:27:17 +0000 (10:27 +0200)
committerShlomi Fish <shlomif@shlomifish.org>
Tue, 14 Dec 2021 08:27:17 +0000 (10:27 +0200)
See: https://github.com/shlomif/fortune-mod/issues/58

use perl rot13
Thanks to https://github.com/leleliu008

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

index 6d6b57ad5ebfbb5679eec0ea5403070afa902ef4..25b29dd87916e06678fdbaa862534feb156057b2 100644 (file)
@@ -1,8 +1,9 @@
 # See: https://github.com/shlomif/fortune-mod/issues/58
+SET (_target_rot  "${CMAKE_CURRENT_BINARY_DIR}/../../rot")
 if ("${IS_CROSS}")
-    SET (_rot  "rot")
+    SET (_rot ${PERL_EXECUTABLE} "${CMAKE_CURRENT_SOURCE_DIR}/../../util/rot.pl")
 else()
-    SET (_rot  "${CMAKE_CURRENT_BINARY_DIR}/../../rot")
+    SET (_rot  "${_target_rot}")
 endif()
 SET (rot_dir "${CMAKE_CURRENT_BINARY_DIR}/rotated")
 FILE(MAKE_DIRECTORY "${rot_dir}")
@@ -16,9 +17,8 @@ FOREACH(c ${OFFENSIVE_COOKIES})
     SET(PATH_PERL ${PERL_EXECUTABLE})
     ADD_CUSTOM_COMMAND(
         OUTPUT "${rot_dest}"
-        COMMAND "${_rot}"
-        ARGS "<" "${SOURCE}" ">" "${rot_dest}"
-        DEPENDS "${SOURCE}" "${_rot}"
+        COMMAND ${_rot} "<" "${SOURCE}" ">" "${rot_dest}"
+        DEPENDS "${SOURCE}" "${_target_rot}"
     )
     ADD_CUSTOM_COMMAND(
         OUTPUT "${DEST}"
diff --git a/fortune-mod/util/rot.pl b/fortune-mod/util/rot.pl
new file mode 100644 (file)
index 0000000..5331520
--- /dev/null
@@ -0,0 +1,20 @@
+#! /usr/bin/env perl
+#
+# Short description for rot.pl
+#
+# rot13 for cross compiling builds:
+# https://github.com/shlomif/fortune-mod/issues/58
+# Version 0.0.1
+# Copyright (C) 2021 Shlomi Fish < https://www.shlomifish.org/ >
+#
+# Licensed under the terms of the MIT license.
+
+use strict;
+use warnings;
+use autodie;
+
+while (<>)
+{
+    tr/A-Za-z/N-ZA-Mn-za-m/;
+    print $_;
+}