]> granicus.if.org Git - fortune-mod/commitdiff
switch to rinutils cmake/pkgconf package
authorShlomi Fish <shlomif@shlomifish.org>
Wed, 18 Dec 2019 11:14:45 +0000 (13:14 +0200)
committerShlomi Fish <shlomif@shlomifish.org>
Wed, 18 Dec 2019 11:14:45 +0000 (13:14 +0200)
.travis.yml
CI-testing/continuous-integration-testing.pl
fortune-mod/CMakeLists.txt

index 31850d9d1958393e8ae20b628628bb8ec13fcaba..b3e09030eed79e435d84f6e2cef256b82954ba40 100644 (file)
@@ -9,6 +9,8 @@ addons:
             - perl
             - make
             - valgrind
+            - xz-utils
+            - zip
 os: linux
 dist: xenial
 before_install:
@@ -19,6 +21,6 @@ install: []
 language: perl
 script:
     - "export FORTUNE_TEST_TIDY=1"
-    - "mkdir B && cd B && cmake ../fortune-mod && make && make check && cd .."
+    - "perl CI-testing/continuous-integration-testing.pl"
     - "rm -fr B"
 sudo: false
index 91e16d9e349b12ddb419133dbd9d59d23ffd54c5..a549f3e4a9a706a923d932fea9d540dbb28f4b6f 100644 (file)
@@ -21,6 +21,7 @@ sub do_system
 my $IS_WIN = ( $^O eq "MSWin32" );
 my $SEP    = $IS_WIN ? "\\" : '/';
 my $MAKE   = $IS_WIN ? 'gmake' : 'make';
+my $SUDO   = $IS_WIN ? '' : 'sudo';
 
 my $cmake_gen;
 GetOptions( 'gen=s' => \$cmake_gen, )
@@ -33,13 +34,54 @@ if ( defined $cmake_gen )
 }
 mkdir('B');
 chdir('B');
+if ( !$ENV{SKIP_RINUTILS_INSTALL} )
+{
+    do_system(
+        {
+            cmd => [ qw#git clone https://github.com/shlomif/rinutils#, ]
+        }
+    );
+    do_system(
+        {
+            cmd => [
+                      qq#cd rinutils && mkdir B && cd B && cmake #
+                    . ( defined($cmake_gen) ? qq# -G "$cmake_gen" # : "" )
+                    . (
+                    defined( $ENV{CMAKE_MAKE_PROGRAM} )
+                    ? " -DCMAKE_MAKE_PROGRAM=$ENV{CMAKE_MAKE_PROGRAM} "
+                    : ""
+                    )
+                    . ( $IS_WIN ? " -DCMAKE_INSTALL_PREFIX=C:/foo " : '' )
+                    . qq# .. && $SUDO $MAKE install#
+            ]
+        }
+    );
+}
+do_system( { cmd => [ "cmake", "--version" ] } );
+my $CMAKE_MODULE_PATH = join ";",
+    (
+    map { ; $_, s%/%\\%gr } (
+        map { ; $_, "$_/Rinutils", "$_/Rinutils/cmake" }
+            map { ; $_, "$_/lib", "$_/lib64" } ( map { ; "c:$_", $_ } ("/foo") )
+    )
+    );
+
+# die "<$CMAKE_MODULE_PATH>";
+if ($IS_WIN)
+{
+    ( $ENV{CMAKE_MODULE_PATH} //= '' ) .= ";$CMAKE_MODULE_PATH;";
+
+    # ( $ENV{PKG_CONFIG_PATH} //= '' ) .= ";C:\\foo\\lib\\pkgconfig;";
+    ( $ENV{PKG_CONFIG_PATH} //= '' ) .=
+        ";/foo/lib/pkgconfig/;/c/foo/lib/pkgconfig/";
+    $ENV{RINUTILS_INCLUDE_DIR} = "C:/foo/include";
+}
 do_system(
     {
         cmd => [
-            $^X, "..${SEP}scripts${SEP}Tatzer",
-            ( defined($cmake_gen) ? (qq#--gen="$cmake_gen"#) : () )
+                  "mkdir B && cd B && cmake  "
+                . ( defined($cmake_gen) ? qq#-G "$cmake_gen"# : "" )
+                . " ../fortune-mod && $MAKE && $MAKE check"
         ]
     }
 );
-do_system( { cmd => [$MAKE] } );
-do_system( { cmd => [ $MAKE, "check", ] } );
index 865e855d3c75a2cb42287b6e5f0aab8bcd180e34..7eb0e6f4773dd02a13e0546e07fa51b092858d85 100644 (file)
@@ -7,6 +7,8 @@ SHLOMIF_COMMON_SETUP("${private_mod_path}")
 
 CMAKE_POLICY(SET CMP0054 NEW)
 
+INCLUDE(FindPkgConfig)
+
 SET (PKGDATADIR_SUBDIR "fortune-mod")
 SET (RELATIVE_PKGDATADIR "${RELATIVE_DATADIR}/${PKGDATADIR_SUBDIR}")
 SET (PKGDATADIR "${DATADIR}/${PKGDATADIR_SUBDIR}")
@@ -98,13 +100,15 @@ SHLOMIF_ADD_COMMON_C_FLAGS()
 
 SHLOMIF_FINALIZE_FLAGS()
 
-SET (rinutils "rinutils")
-IF (NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${rinutils}")
-    EXECUTE_PROCESS(COMMAND "git" "clone" "https://github.com/shlomif/rinutils.git" "${rinutils}"
-        WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
-    )
+find_package(Rinutils REQUIRED)
+if ()
+    PKG_CHECK_MODULES(RINUTILS REQUIRED "librinutils")
+    IF (NOT "${RINUTILS_FOUND}")
+        MESSAGE (FATAL "rinutils could not be found.")
+    ENDIF ()
 ENDIF ()
-INCLUDE_DIRECTORIES(BEFORE "${CMAKE_CURRENT_SOURCE_DIR}/${rinutils}/rinutils/include")
+
+INCLUDE_DIRECTORIES(AFTER ${RINUTILS_INCLUDE_DIR} ${RINUTILS_INCLUDE_DIRS})
 
 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 -Wchkp -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")