niobio / cld2

Automatically exported from code.google.com/p/cld2
0 stars 0 forks source link

please use CFLAGS CXXFLAGS CPPFLAGS and LDFLAGS #28

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
patch attached.

Description: Adding CFLAGS CXXFLAGS CPPFLAGS and LDFLAGS to the build
Author: Gianfranco Costamagna <costamagnagianfranco@yahoo.it>
Origin: debian
Last-Update: <2015-01-10>

--- cld2-0.0.0~svn193.orig/internal/compile.sh
+++ cld2-0.0.0~svn193/internal/compile.sh
@@ -14,7 +14,7 @@
 #  See the License for the specific language governing permissions and
 #  limitations under the License.

-g++ -O2 -m64  compact_lang_det_test.cc \
+g++ $CFLAGS $CPPFLAGS $CXXFLAGS compact_lang_det_test.cc \
   cldutil.cc cldutil_shared.cc compact_lang_det.cc  compact_lang_det_hint_code.cc \
   compact_lang_det_impl.cc  debug.cc fixunicodevalue.cc \
   generated_entities.cc  generated_language.cc generated_ulscript.cc  \
@@ -24,10 +24,10 @@ g++ -O2 -m64  compact_lang_det_test.cc \
   cld_generated_cjk_delta_bi_4.cc generated_distinct_bi_0.cc  \
   cld2_generated_quadchrome_2.cc cld2_generated_deltaoctachrome.cc \
   cld2_generated_distinctoctachrome.cc  cld_generated_score_quad_octa_2.cc  \
-  -o compact_lang_det_test_chrome_2
+  -o compact_lang_det_test_chrome_2 $LDFLAGS
 echo "  compact_lang_det_test_chrome_2 compiled"

-g++ -O2 -m64  compact_lang_det_test.cc \
+g++ $CFLAGS $CPPFLAGS $CXXFLAGS compact_lang_det_test.cc \
   cldutil.cc cldutil_shared.cc compact_lang_det.cc  compact_lang_det_hint_code.cc \
   compact_lang_det_impl.cc  debug.cc fixunicodevalue.cc \
   generated_entities.cc  generated_language.cc generated_ulscript.cc  \
@@ -37,11 +37,11 @@ g++ -O2 -m64  compact_lang_det_test.cc \
   cld_generated_cjk_delta_bi_4.cc generated_distinct_bi_0.cc  \
   cld2_generated_quadchrome_16.cc cld2_generated_deltaoctachrome.cc \
   cld2_generated_distinctoctachrome.cc  cld_generated_score_quad_octa_2.cc  \
-  -o compact_lang_det_test_chrome_16
+  -o compact_lang_det_test_chrome_16 $LDFLAGS
 echo "  compact_lang_det_test_chrome_16 compiled"

-g++ -O2 -m64  cld2_unittest.cc \
+g++ $CFLAGS $CPPFLAGS $CXXFLAGS cld2_unittest.cc \
   cldutil.cc cldutil_shared.cc compact_lang_det.cc  compact_lang_det_hint_code.cc \
   compact_lang_det_impl.cc  debug.cc fixunicodevalue.cc \
   generated_entities.cc  generated_language.cc generated_ulscript.cc  \
@@ -51,10 +51,10 @@ g++ -O2 -m64  cld2_unittest.cc \
   cld_generated_cjk_delta_bi_4.cc generated_distinct_bi_0.cc  \
   cld2_generated_quadchrome_2.cc cld2_generated_deltaoctachrome.cc \
   cld2_generated_distinctoctachrome.cc  cld_generated_score_quad_octa_2.cc  \
-  -o cld2_unittest_chrome_2
+  -o cld2_unittest_chrome_2 $LDFLAGS
 echo "  cld2_unittest_chrome_2 compiled"

-g++ -O2 -m64  -Davoid_utf8_string_constants cld2_unittest.cc \
+g++ $CFLAGS $CPPFLAGS $CXXFLAGS -Davoid_utf8_string_constants cld2_unittest.cc 
\
   cldutil.cc cldutil_shared.cc compact_lang_det.cc  compact_lang_det_hint_code.cc \
   compact_lang_det_impl.cc  debug.cc fixunicodevalue.cc \
   generated_entities.cc  generated_language.cc generated_ulscript.cc  \
@@ -64,7 +64,7 @@ g++ -O2 -m64  -Davoid_utf8_string_consta
   cld_generated_cjk_delta_bi_4.cc generated_distinct_bi_0.cc  \
   cld2_generated_quadchrome_2.cc cld2_generated_deltaoctachrome.cc \
   cld2_generated_distinctoctachrome.cc  cld_generated_score_quad_octa_2.cc  \
-  -o cld2_unittest_avoid_chrome_2
+  -o cld2_unittest_avoid_chrome_2 $LDFLAGS
 echo "  cld2_unittest_avoid_chrome_2 compiled"

--- cld2-0.0.0~svn193.orig/internal/compile_dynamic.sh
+++ cld2-0.0.0~svn193/internal/compile_dynamic.sh
@@ -15,7 +15,7 @@
 #  limitations under the License.

 # The data tool, which can be used to read and write CLD2 dynamic data files
-g++ -O2 -m64 cld2_dynamic_data_tool.cc \
+g++ $CFLAGS $CPPFLAGS $CXXFLAGS cld2_dynamic_data_tool.cc \
   cld2_dynamic_data.h cld2_dynamic_data.cc \
   cld2_dynamic_data_extractor.h cld2_dynamic_data_extractor.cc \
   cld2_dynamic_data_loader.h  cld2_dynamic_data_loader.cc \
@@ -28,11 +28,11 @@ g++ -O2 -m64 cld2_dynamic_data_tool.cc \
   cld_generated_cjk_delta_bi_4.cc generated_distinct_bi_0.cc  \
   cld2_generated_quadchrome_2.cc cld2_generated_deltaoctachrome.cc \
   cld2_generated_distinctoctachrome.cc  cld_generated_score_quad_octa_2.cc  \
-  -o cld2_dynamic_data_tool
+  -o cld2_dynamic_data_tool $LDFLAGS
 echo "  cld2_dynamic_data_tool compiled"

 # Tests for Chromium flavored dynamic CLD2
-g++ -O2 -m64 -D CLD2_DYNAMIC_MODE compact_lang_det_test.cc \
+g++ $CFLAGS $CPPFLAGS $CXXFLAGS -D CLD2_DYNAMIC_MODE compact_lang_det_test.cc \
   cld2_dynamic_data.h cld2_dynamic_data.cc \
   cld2_dynamic_data_extractor.h cld2_dynamic_data_extractor.cc \
   cld2_dynamic_data_loader.h  cld2_dynamic_data_loader.cc \
@@ -41,12 +41,12 @@ g++ -O2 -m64 -D CLD2_DYNAMIC_MODE compac
   generated_entities.cc  generated_language.cc generated_ulscript.cc  \
   getonescriptspan.cc lang_script.cc offsetmap.cc  scoreonescriptspan.cc \
   tote.cc utf8statetable.cc  \
-  -o compact_lang_det_dynamic_test_chrome
+  -o compact_lang_det_dynamic_test_chrome $LDFLAGS
 echo "  compact_lang_det_dynamic_test_chrome compiled"

 # Unit tests, in dynamic mode
-g++ -O2 -m64 -g3 -D CLD2_DYNAMIC_MODE cld2_unittest.cc \
+g++ $CFLAGS $CPPFLAGS $CXXFLAGS -g3 -D CLD2_DYNAMIC_MODE cld2_unittest.cc \
   cld2_dynamic_data.h cld2_dynamic_data.cc \
   cld2_dynamic_data_loader.h  cld2_dynamic_data_loader.cc \
   cldutil.cc cldutil_shared.cc compact_lang_det.cc  compact_lang_det_hint_code.cc \
@@ -54,11 +54,11 @@ g++ -O2 -m64 -g3 -D CLD2_DYNAMIC_MODE cl
   generated_entities.cc  generated_language.cc generated_ulscript.cc  \
   getonescriptspan.cc lang_script.cc offsetmap.cc  scoreonescriptspan.cc \
   tote.cc utf8statetable.cc  \
-  -o cld2_dynamic_unittest
+  -o cld2_dynamic_unittest $LDFLAGS
 echo "  cld2_dynamic_unittest compiled"

 # Shared library, in dynamic mode
-g++ -shared -fPIC -O2 -m64 -D CLD2_DYNAMIC_MODE \
+g++ $CFLAGS $CPPFLAGS $CXXFLAGS -shared -fPIC -D CLD2_DYNAMIC_MODE \
   cld2_dynamic_data.h cld2_dynamic_data.cc \
   cld2_dynamic_data_loader.h  cld2_dynamic_data_loader.cc \
   cldutil.cc cldutil_shared.cc compact_lang_det.cc compact_lang_det_hint_code.cc \
@@ -66,6 +66,6 @@ g++ -shared -fPIC -O2 -m64 -D CLD2_DYNAM
   generated_entities.cc  generated_language.cc generated_ulscript.cc  \
   getonescriptspan.cc lang_script.cc offsetmap.cc  scoreonescriptspan.cc \
   tote.cc utf8statetable.cc  \
-  -o libcld2_dynamic.so
+  -o libcld2_dynamic.so $LDFLAGS
 echo "  libcld2_dynamic.so compiled"

--- cld2-0.0.0~svn193.orig/internal/compile_full.sh
+++ cld2-0.0.0~svn193/internal/compile_full.sh
@@ -14,7 +14,7 @@
 #  See the License for the specific language governing permissions and
 #  limitations under the License.

-g++ -O2 -m64  compact_lang_det_test.cc \
+g++ $CFLAGS $CPPFLAGS $CXXFLAGS compact_lang_det_test.cc \
   cldutil.cc cldutil_shared.cc compact_lang_det.cc  compact_lang_det_hint_code.cc \
   compact_lang_det_impl.cc  debug.cc fixunicodevalue.cc \
   generated_entities.cc  generated_language.cc generated_ulscript.cc  \
@@ -24,10 +24,10 @@ g++ -O2 -m64  compact_lang_det_test.cc \
   cld_generated_cjk_delta_bi_32.cc generated_distinct_bi_0.cc  \
   cld2_generated_quad0122.cc cld2_generated_deltaocta0122.cc \
   cld2_generated_distinctocta0122.cc  cld_generated_score_quad_octa_0122.cc  \
-  -o compact_lang_det_test_full
+  -o compact_lang_det_test_full $LDFLAGS
 echo "  compact_lang_det_test_full compiled"

-g++ -O2 -m64  cld2_unittest_full.cc \
+g++ $CFLAGS $CPPFLAGS $CXXFLAGS cld2_unittest_full.cc \
   cldutil.cc cldutil_shared.cc compact_lang_det.cc  compact_lang_det_hint_code.cc \
   compact_lang_det_impl.cc  debug.cc fixunicodevalue.cc \
   generated_entities.cc  generated_language.cc generated_ulscript.cc  \
@@ -37,10 +37,10 @@ g++ -O2 -m64  cld2_unittest_full.cc \
   cld_generated_cjk_delta_bi_32.cc generated_distinct_bi_0.cc  \
   cld2_generated_quad0122.cc cld2_generated_deltaocta0122.cc \
   cld2_generated_distinctocta0122.cc  cld_generated_score_quad_octa_0122.cc  \
-  -o cld2_unittest_full
+  -o cld2_unittest_full $LDFLAGS
 echo "  cld2_unittest_full compiled"

-g++ -O2 -m64  -Davoid_utf8_string_constants cld2_unittest_full.cc \
+g++ $CFLAGS $CPPFLAGS $CXXFLAGS -Davoid_utf8_string_constants 
cld2_unittest_full.cc \
   cldutil.cc cldutil_shared.cc compact_lang_det.cc  compact_lang_det_hint_code.cc \
   compact_lang_det_impl.cc  debug.cc fixunicodevalue.cc \
   generated_entities.cc  generated_language.cc generated_ulscript.cc  \
@@ -50,6 +50,6 @@ g++ -O2 -m64  -Davoid_utf8_string_consta
   cld_generated_cjk_delta_bi_32.cc generated_distinct_bi_0.cc  \
   cld2_generated_quad0122.cc cld2_generated_deltaocta0122.cc \
   cld2_generated_distinctocta0122.cc  cld_generated_score_quad_octa_0122.cc  \
-  -o cld2_unittest_full_avoid
+  -o cld2_unittest_full_avoid $LDFLAGS
 echo "  cld2_unittest_full_avoid compiled"

--- cld2-0.0.0~svn193.orig/internal/compile_libs.sh
+++ cld2-0.0.0~svn193/internal/compile_libs.sh
@@ -14,7 +14,7 @@
 #  See the License for the specific language governing permissions and
 #  limitations under the License.

-g++ -shared -fPIC -O2 -m64 \
+g++ $CFLAGS $CPPFLAGS $CXXFLAGS -shared -fPIC \
   cldutil.cc cldutil_shared.cc compact_lang_det.cc compact_lang_det_hint_code.cc \
   compact_lang_det_impl.cc  debug.cc fixunicodevalue.cc \
   generated_entities.cc  generated_language.cc generated_ulscript.cc  \
@@ -24,9 +24,9 @@ g++ -shared -fPIC -O2 -m64 \
   cld_generated_cjk_delta_bi_4.cc generated_distinct_bi_0.cc  \
   cld2_generated_quadchrome_2.cc cld2_generated_deltaoctachrome.cc \
   cld2_generated_distinctoctachrome.cc  cld_generated_score_quad_octa_2.cc  \
-  -o libcld2.so
+  -o libcld2.so $LDFLAGS

-g++ -shared -fPIC -O2 -m64 \
+g++ $CFLAGS $CPPFLAGS $CXXFLAGS -shared -fPIC \
   cldutil.cc cldutil_shared.cc compact_lang_det.cc compact_lang_det_hint_code.cc \
   compact_lang_det_impl.cc  debug.cc fixunicodevalue.cc \
   generated_entities.cc  generated_language.cc generated_ulscript.cc  \
@@ -36,5 +36,5 @@ g++ -shared -fPIC -O2 -m64 \
   cld_generated_cjk_delta_bi_32.cc generated_distinct_bi_0.cc  \
   cld2_generated_quad0122.cc cld2_generated_deltaocta0122.cc \
   cld2_generated_distinctocta0122.cc  cld_generated_score_quad_octa_0122.cc  \
-  -o libcld2_full.so
+  -o libcld2_full.so $LDFLAGS

(there is an ongoing debian effort to package it)

Original issue reported on code.google.com by costamag...@gmail.com on 10 Feb 2015 at 3:36

GoogleCodeExporter commented 9 years ago
This seems reasonable to me, and I'll be happy to commit it. For that matter, 
maybe we should be using a makefile (or *something* other than a shell 
script...)

Thanks for the patch.

Original comment by andrewha...@google.com on 11 Feb 2015 at 7:40

GoogleCodeExporter commented 9 years ago
BTW with around 20 cmake lines you can have everything working correctly.

that kind of build scripts are really painful for every kind of usage.

you are using -m64, this is wrong to me, do you want to exclude everybody using 
a non64 arch?

Original comment by costamag...@gmail.com on 11 Feb 2015 at 7:55

GoogleCodeExporter commented 9 years ago
This is committed, along with some other minor tweaks (warning messages and the 
SONAME bits you asked for in issue 29) in r194.

Regarding your comment in #2: CLD's primary consumer is the Chromium 
open-source project, which doesn't use these scripts at all - it has a 
completely custom build system (GYP/GN and ninja) that have their own "unique" 
mechanisms for setting the various flags and options. The shell scripts are 
really just for hand-running tests and tweaking the build, it's kind of 
expected that an embedder would have their own tech for building that they'd 
want to pull this into.

I'm happy to take submissions for more robust (and simple) build logic! If 
you're willing to write it up, send it along and if it looks reasonable we'll 
get it committed and credit you in the commit message.

Original comment by andrewha...@google.com on 12 Feb 2015 at 11:26