]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] contrib/snowball: fix modules.h location
authorPeter Wu <peter@lekensteyn.nl>
Tue, 21 Jan 2020 01:05:49 +0000 (01:05 +0000)
committerPeter Wu <peter@lekensteyn.nl>
Tue, 21 Jan 2020 01:30:48 +0000 (01:30 +0000)
* Reproducible builds! No more absolute paths in source files, so the
  generated binary is also invariant of the build directory.
* Output modules.h in snowball/libstemmer/ instead of snowball/. This
  allows removal of the extra include directory and -f option.
* This partially reverts some changes in
  https://github.com/snowballstem/snowball/commit/d178f201fda878c26538401650a7d46c37a5e6f1
  and matches the commands in GNUmakefile.

contrib/snowball/CMakeLists.txt
contrib/snowball/libstemmer/mkmodules.pl

index 8674e2d88a7539424d7394c0fa506f7bf10203f4..7910c7b3a1fabf6ed5ef6b7f564a80dc5b792224 100644 (file)
@@ -37,14 +37,14 @@ MACRO(gen_stem IN ENCODING)
                SET(_input "${CMAKE_CURRENT_SOURCE_DIR}/algorithms/${_it}/stem_${_in_enc}.sbl")
                IF(${_in_enc} STREQUAL "Unicode" AND NOT EXISTS ${_input})
                        ADD_CUSTOM_COMMAND(OUTPUT ${_source}
-                               COMMAND ${CMAKE_CURRENT_BINARY_DIR}/snowball  "${CMAKE_CURRENT_SOURCE_DIR}/algorithms/${_it}/stem_ISO_8859_1.sbl" -o ${_base} -eprefix ${_it}_${ENCODING}_ -r ${CMAKE_CURRENT_SOURCE_DIR}/runtime -u
+                               COMMAND ${CMAKE_CURRENT_BINARY_DIR}/snowball  "${CMAKE_CURRENT_SOURCE_DIR}/algorithms/${_it}/stem_ISO_8859_1.sbl" -o ${_base} -eprefix ${_it}_${ENCODING}_ -r ../runtime -u
                                DEPENDS snowball)
                        LIST(APPEND STEMMER_SOURCES ${_source})
 
                ELSE()
                IF(EXISTS "${_input}")
                        ADD_CUSTOM_COMMAND(OUTPUT ${_source}
-                               COMMAND ${CMAKE_CURRENT_BINARY_DIR}/snowball ${_input} -o ${_base} -eprefix ${_it}_${ENCODING}_ -r ${CMAKE_CURRENT_SOURCE_DIR}/runtime -u
+                               COMMAND ${CMAKE_CURRENT_BINARY_DIR}/snowball ${_input} -o ${_base} -eprefix ${_it}_${ENCODING}_ -r ../runtime -u
                                DEPENDS snowball)
                        LIST(APPEND STEMMER_SOURCES ${_source})
                ENDIF()
@@ -53,12 +53,11 @@ MACRO(gen_stem IN ENCODING)
 ENDMACRO()
 
 INCLUDE_DIRECTORIES("include")
-INCLUDE_DIRECTORIES("${CMAKE_CURRENT_BINARY_DIR}/libstemmer")
 
 ADD_EXECUTABLE(snowball ${COMPILER_SOURCES})
 
 ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/libstemmer/modules.h
- COMMAND ${PERL_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/libstemmer/mkmodules.pl -f ${CMAKE_CURRENT_BINARY_DIR}/libstemmer/modules.h ${CMAKE_CURRENT_BINARY_DIR}/libstemmer ${CMAKE_CURRENT_SOURCE_DIR}/libstemmer/modules.txt ${CMAKE_CURRENT_BINARY_DIR}/libstemmer/mkinc.mak)
+ COMMAND ${PERL_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/libstemmer/mkmodules.pl libstemmer/modules.h libstemmer ${CMAKE_CURRENT_SOURCE_DIR}/libstemmer/modules.txt libstemmer/mkinc.mak)
 ADD_CUSTOM_TARGET(modules DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/libstemmer/modules.h")
 
 SET(STEMMER_SOURCES "${CMAKE_CURRENT_BINARY_DIR}/libstemmer/libstemmer.c")
index 93870b24752fcb4fc8d94d37803eb08638f42320..ff8c19e7cdd7eb7db7fd645842eda039f1796ee0 100755 (executable)
@@ -1,17 +1,8 @@
 #!/usr/bin/perl -w
 use strict;
-use Getopt::Std;
 
 my $progname = $0;
 
-my $include_path = '../';
-our($opt_f);
-
-getopts('f');
-if ($opt_f) {
-       $include_path = '';
-}
-
 if (scalar @ARGV < 4 || scalar @ARGV > 5) {
   print "Usage: $progname <outfile> <C source directory> <modules description file> <source list file> [<extn>]\n";
   exit 1;
@@ -109,7 +100,7 @@ EOS
     foreach $lang (@algorithms) {
         my $hashref = $algorithm_encs{$lang};
         foreach $enc (sort keys (%$hashref)) {
-            print OUT "#include \"${include_path}$c_src_dir/stem_${enc}_$lang.h\"\n";
+            print OUT "#include \"../$c_src_dir/stem_${enc}_$lang.h\"\n";
         }
     }