summarylogtreecommitdiffstats
path: root/freeling-4.2.patch
blob: 89b99e942a56c69ecb09dddb6771b4bd204959d4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
diff --unified --text --recursive -x data package.orig/CMakeLists.txt package.new/CMakeLists.txt
--- package.orig/CMakeLists.txt	2020-08-31 12:26:05.000000000 +0200
+++ package.new/CMakeLists.txt	2021-06-28 12:40:19.026542598 +0200
@@ -84,7 +84,7 @@
   # build dictionary for each language
   if (EXISTS ${CMAKE_SOURCE_DIR}/data/${lg}/dictionary/header)
     install(CODE "message(STATUS \"Creating ${lg} dictionary...\")" )
-    install(CODE "execute_process(COMMAND ${CMAKE_BINARY_DIR}/src/utilities/build-dict ${CMAKE_SOURCE_DIR}/data/${lg}/dictionary/header ${CMAKE_SOURCE_DIR}/data/${lg}/dictionary/entries  OUTPUT_FILE ${CMAKE_INSTALL_PREFIX}/share/freeling/${lg}/dicc.src RESULT_VARIABLE _res) " )
+    install(CODE "execute_process(COMMAND ${CMAKE_BINARY_DIR}/src/utilities/build-dict ${CMAKE_SOURCE_DIR}/data/${lg}/dictionary/header ${CMAKE_SOURCE_DIR}/data/${lg}/dictionary/entries  OUTPUT_FILE \$ENV\{DESTDIR\}${CMAKE_INSTALL_PREFIX}/share/freeling/${lg}/dicc.src RESULT_VARIABLE _res) " )
     # make sure installation helpers work.  If this one works, the others should too.
     install(CODE "If (NOT \${_res} EQUAL \"0\")
                      message(FATAL_ERROR \"Error '\${_res}' while executing dictionary indexation program. Make sure compilation ended without errors, and that boost libraries can be found in the path. \")
@@ -95,14 +95,14 @@
     # for variants matching this language, build specific dictionary and multiwords file
     if (${variant} MATCHES "^${lg}/")
       install(CODE "message(STATUS \"-- Creating ${variant} dictionary...\")" )
-      install(CODE "file(MAKE_DIRECTORY ${CMAKE_INSTALL_PREFIX}/share/freeling/${variant})")      
-      install(CODE "execute_process(COMMAND ${CMAKE_BINARY_DIR}/src/utilities/build-dict ${CMAKE_SOURCE_DIR}/data/${variant}/dictionary/header ${CMAKE_SOURCE_DIR}/data/${lg}/dictionary/entries ${CMAKE_SOURCE_DIR}/data/${variant}/dictionary/entries ${CMAKE_SOURCE_DIR}/data/${variant}/remove OUTPUT_FILE ${CMAKE_INSTALL_PREFIX}/share/freeling/${variant}/dicc.src RESULT_VARIABLE _res)" )
+      install(CODE "file(MAKE_DIRECTORY \$ENV\{DESTDIR\}${CMAKE_INSTALL_PREFIX}/share/freeling/${variant})")      
+      install(CODE "execute_process(COMMAND ${CMAKE_BINARY_DIR}/src/utilities/build-dict ${CMAKE_SOURCE_DIR}/data/${variant}/dictionary/header ${CMAKE_SOURCE_DIR}/data/${lg}/dictionary/entries ${CMAKE_SOURCE_DIR}/data/${variant}/dictionary/entries ${CMAKE_SOURCE_DIR}/data/${variant}/remove OUTPUT_FILE \$ENV\{DESTDIR\}${CMAKE_INSTALL_PREFIX}/share/freeling/${variant}/dicc.src RESULT_VARIABLE _res)" )
       install(CODE "If (NOT \${_res} EQUAL \"0\")
                         message(FATAL_ERROR \"multiword fusion failed with error: \${_res}\")
                     endif() ")
       if (EXISTS ${CMAKE_SOURCE_DIR}/data/${variant}/locucions.dat)
         install(CODE "message(STATUS \"-- Merging ${variant} multiwords...\")" )
-	install(CODE "execute_process(COMMAND ${CMAKE_BINARY_DIR}/src/utilities/fusion-mw ${CMAKE_SOURCE_DIR}/data/${variant}/locucions.dat ${CMAKE_SOURCE_DIR}/data/${lg}/locucions.dat OUTPUT_FILE ${CMAKE_INSTALL_PREFIX}/share/freeling/${variant}/locucions.dat RESULT_VARIABLE _res)" )
+	install(CODE "execute_process(COMMAND ${CMAKE_BINARY_DIR}/src/utilities/fusion-mw ${CMAKE_SOURCE_DIR}/data/${variant}/locucions.dat ${CMAKE_SOURCE_DIR}/data/${lg}/locucions.dat OUTPUT_FILE \$ENV\{DESTDIR\}${CMAKE_INSTALL_PREFIX}/share/freeling/${variant}/locucions.dat RESULT_VARIABLE _res)" )
         install(CODE "If (NOT \${_res} EQUAL \"0\")
                         message(FATAL_ERROR \"multiword fusion failed with error: \${_res}\")
                       endif() ")
@@ -113,7 +113,7 @@
   # build phonetic dictionary if needed
   if (EXISTS ${CMAKE_SOURCE_DIR}/data/${lg}/alternatives-phon.dat)
     install(CODE "message(STATUS \"-- Creating ${lg} phonetic dictionary...\")" )
-    install(CODE "execute_process(COMMAND ${CMAKE_BINARY_DIR}/src/utilities/dicc2phon ${CMAKE_INSTALL_PREFIX}/share/freeling/${lg}/dicc.src ${CMAKE_INSTALL_PREFIX}/share/freeling/${lg}/alternatives-phon.dat RESULT_VARIABLE _res)" )
+    install(CODE "execute_process(COMMAND ${CMAKE_BINARY_DIR}/src/utilities/dicc2phon \$ENV\{DESTDIR\}${CMAKE_INSTALL_PREFIX}/share/freeling/${lg}/dicc.src \$ENV\{DESTDIR\}${CMAKE_INSTALL_PREFIX}/share/freeling/${lg}/alternatives-phon.dat RESULT_VARIABLE _res)" )
     install(CODE "If (NOT \${_res} EQUAL \"0\")
                       message(FATAL_ERROR \"creating phonetic dictionary failed with error: \${_res}\")
                   endif() ")
@@ -130,7 +130,7 @@
 
   foreach (model ${aafiles})
     STRING(REGEX REPLACE ".aa\$" "" gzfile "${model}")
-    STRING(REGEX REPLACE "${CMAKE_SOURCE_DIR}/data" "${CMAKE_INSTALL_PREFIX}/share/freeling" gzfile "${gzfile}")
+    STRING(REGEX REPLACE "${CMAKE_SOURCE_DIR}/data" "\$ENV\{DESTDIR\}${CMAKE_INSTALL_PREFIX}/share/freeling" gzfile "${gzfile}")
     install(CODE "message(STATUS \"-- Rebuilding data file ${gzfile}\")" )
     install(CODE "execute_process(COMMAND ${CMAKE_BINARY_DIR}/src/utilities/gz-cat ${model} ${gzfile} RESULT_VARIABLE _res)")
     install(CODE "If (NOT \${_res} EQUAL \"0\")
diff --unified --text --recursive -x data package.orig/src/CMakeLists.txt package.new/src/CMakeLists.txt
--- package.orig/src/CMakeLists.txt	2020-08-31 12:26:05.000000000 +0200
+++ package.new/src/CMakeLists.txt	2021-06-30 11:03:37.953011970 +0200
@@ -14,7 +14,7 @@
   set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
 endif()
 
-set(EIGEN3_INCLUDE_DIR ${PROJECT_SOURCE_DIR}/src/eigen3)
+set(EIGEN3_INCLUDE_DIR /usr/include/eigen3)
 add_subdirectory(libdynet)
 
 add_subdirectory(crfsuite)
@@ -32,6 +32,3 @@
         FILES_MATCHING PATTERN "*.h"
         PATTERN "coref.h" EXCLUDE
         PATTERN "coref_fex.h" EXCLUDE)
-
-install(DIRECTORY eigen3 DESTINATION include)
-
diff --unified --text --recursive -x data package.orig/src/crfsuite/CMakeLists.txt package.new/src/crfsuite/CMakeLists.txt
--- package.orig/src/crfsuite/CMakeLists.txt	2020-08-31 12:26:05.000000000 +0200
+++ package.new/src/crfsuite/CMakeLists.txt	2021-06-25 11:03:12.849519427 +0200
@@ -38,7 +38,7 @@
   add_executable(crfsuite_bin ${crfsuite_main_SRC})
   target_include_directories(crfsuite_bin PRIVATE crfsuite/frontend)
   target_link_libraries(crfsuite_bin crfsuite)
-  set_target_properties(crfsuite_bin PROPERTIES OUTPUT_NAME crfsuite)
+  set_target_properties(crfsuite_bin PROPERTIES OUTPUT_NAME "freeling-crfsuite")
 
   install(TARGETS crfsuite_bin
           RUNTIME DESTINATION bin)
diff --unified --text --recursive -x data package.orig/src/libfreeling/csr_kb.cc package.new/src/libfreeling/csr_kb.cc
--- package.orig/src/libfreeling/csr_kb.cc	2020-08-31 12:26:05.000000000 +0200
+++ package.new/src/libfreeling/csr_kb.cc	2021-06-16 17:05:37.352153849 +0200
@@ -1,6 +1,8 @@
 
 #include <fstream>
 #include <sstream>
+#include <cmath>
+using std::fabs;
 
 #include "freeling/morfo/util.h"
 #include "freeling/morfo/traces.h"
diff --unified --text --recursive -x data package.orig/src/libfreeling/numbers/numbers_cs.cc package.new/src/libfreeling/numbers/numbers_cs.cc
--- package.orig/src/libfreeling/numbers/numbers_cs.cc	2020-08-31 12:26:05.000000000 +0200
+++ package.new/src/libfreeling/numbers/numbers_cs.cc	2021-06-16 17:08:01.320516161 +0200
@@ -26,6 +26,8 @@
 //
 ////////////////////////////////////////////////////////////////
 
+#include <cmath>
+
 #include "freeling/morfo/traces.h"
 #include "freeling/morfo/util.h"
 #include "freeling/morfo/numbers_modules.h"
diff --unified --text --recursive -x data package.orig/src/libfreeling/summarizer/summarizer.cc package.new/src/libfreeling/summarizer/summarizer.cc
--- package.orig/src/libfreeling/summarizer/summarizer.cc	2020-08-31 12:26:05.000000000 +0200
+++ package.new/src/libfreeling/summarizer/summarizer.cc	2021-06-16 17:11:18.559374674 +0200
@@ -26,6 +26,7 @@
 //
 ////////////////////////////////////////////////////////////////
 
+#include <cmath>
 
 #include "freeling/morfo/summarizer.h"
 #include "freeling/morfo/configfile.h"
diff --unified --text --recursive -x data package.orig/src/libtreeler/main/CMakeLists.txt package.new/src/libtreeler/main/CMakeLists.txt
--- package.orig/src/libtreeler/main/CMakeLists.txt	2020-08-31 12:26:05.000000000 +0200
+++ package.new/src/libtreeler/main/CMakeLists.txt	2021-06-25 11:44:23.111838303 +0200
@@ -9,7 +9,7 @@
 add_executable(treeler_bin ${treeler_main_SRC})
 target_include_directories(treeler_bin PRIVATE .)
 target_link_libraries(treeler_bin treeler ${ZLIB_LIBRARIES})
-set_target_properties(treeler_bin PROPERTIES OUTPUT_NAME treeler)
+set_target_properties(treeler_bin PROPERTIES OUTPUT_NAME "freeling-treeler")
 
 install(TARGETS treeler_bin
         RUNTIME DESTINATION bin)
diff --unified --text --recursive -x data package.orig/src/main/CMakeLists.txt package.new/src/main/CMakeLists.txt
--- package.orig/src/main/CMakeLists.txt	2020-08-31 12:26:05.000000000 +0200
+++ package.new/src/main/CMakeLists.txt	2021-06-28 16:00:34.152067571 +0200
@@ -40,8 +40,11 @@
           LIBRARY DESTINATION lib
           ARCHIVE DESTINATION lib/static)
 else()
-  install(PROGRAMS sample_analyzer/analyze DESTINATION bin)
-  install(PROGRAMS sample_analyzer/fl_initialize DESTINATION bin)
+  set_target_properties(analyzer PROPERTIES OUTPUT_NAME "freeling-analyzer")
+  set_target_properties(threaded_analyzer PROPERTIES OUTPUT_NAME "freeling-threaded-analyzer")
+  set_target_properties(analyzer_client PROPERTIES OUTPUT_NAME "freeling-analyzer-client")
+  install(PROGRAMS sample_analyzer/analyze DESTINATION bin RENAME "freeling-analyze")
+  install(PROGRAMS sample_analyzer/fl_initialize DESTINATION bin RENAME "freeling-initialize")
   install(TARGETS analyzer threaded_analyzer analyzer_client
           RUNTIME DESTINATION bin
           LIBRARY DESTINATION lib
diff --unified --text --recursive -x data package.orig/src/main/sample_analyzer/analyze package.new/src/main/sample_analyzer/analyze
--- package.orig/src/main/sample_analyzer/analyze	2020-08-31 12:26:05.000000000 +0200
+++ package.new/src/main/sample_analyzer/analyze	2021-06-28 17:10:22.442150765 +0200
@@ -23,7 +23,7 @@
 shopt -s extglob
 
 ## Execute FreeLing environment initialization
-. $(cd $(dirname $0) && echo $PWD)/fl_initialize $@
+. /usr/bin/freeling-initialize $@
 
 if [[ "$1" == "stop" ]]; then
   # If the first argument is the word "stop", signal the server to stop
@@ -35,7 +35,7 @@
   kill -15 $2
 else
   ## otherwise call the actual executable with given arguments 
-  $FREELING/bin/analyzer $param
+  /usr/bin/freeling-analyzer $param
 fi
 
 
diff --unified --text --recursive -x data package.orig/src/main/sample_analyzer/fl_initialize package.new/src/main/sample_analyzer/fl_initialize
--- package.orig/src/main/sample_analyzer/fl_initialize	2020-08-31 12:26:05.000000000 +0200
+++ package.new/src/main/sample_analyzer/fl_initialize	2021-06-28 17:10:32.708922645 +0200
@@ -5,24 +5,8 @@
 ##
 #############################################
 
-##--- Get FreeLing installation from the location of this script
-FREELING=$(dirname $(cd $(dirname $0) && echo $PWD))
+export FREELINGSHARE=/usr/share/freeling
 
-##--- define FREELINGSHARE (if not already defined), which is used in default config files
-if [ "x$FREELINGSHARE" = "x" ]; then
-  export FREELINGSHARE=$FREELING/share/freeling
-fi
-
-#--- set paths to libraries required to execute FreeLing
-OS=`uname -s`
-if [ $OS == "Linux" ]; then 
-   export LD_LIBRARY_PATH=$FREELING/lib:$LD_LIBRARY_PATH
-else
-   # it is a Mac
-   export DYLD_LIBRARY_PATH=$FREELING/lib:$DYLD_LIBRARY_PATH
-fi
-
-#--- Pass all parameters to the executable, fixing the config file path if necessary
 i=1;  eval arg=\${$i}
 param=""
 while [[ $i -le $# ]]; do
@@ -35,7 +19,7 @@
      if [ -e $arg ]; then
        param="$param $arg"
      else 
-       param="$param $FREELING/share/freeling/config/$arg"
+       param="$param /usr/share/freeling/config/$arg"
      fi
    fi
 
diff --unified --text --recursive -x data package.orig/src/utilities/CMakeLists.txt package.new/src/utilities/CMakeLists.txt
--- package.orig/src/utilities/CMakeLists.txt	2020-08-31 12:26:05.000000000 +0200
+++ package.new/src/utilities/CMakeLists.txt	2021-06-25 11:02:07.908903840 +0200
@@ -31,7 +31,7 @@
 # convert_model
 add_executable(convert_model embeddings/convert_model.cc)
 target_link_libraries(convert_model freeling)
-
+set_target_properties(convert_model PROPERTIES OUTPUT_NAME "freeling-convert-model")
 install(TARGETS convert_model
         RUNTIME DESTINATION bin
         LIBRARY DESTINATION lib