From 009601d5340e1b55cb589a4fdec7b101a455ff3f Mon Sep 17 00:00:00 2001 From: stephan Date: Thu, 14 Nov 2024 19:25:23 +0000 Subject: [PATCH] Remove $prefix/include from the default -I path because it can cause the build to pick up an unintended copy of sqlite3.h. Extend the ICU configure support (the origin of -I$prefix/include) to enable fetching the -I path from icu-config and apply it only to those objects which need it. FossilOrigin-Name: f778dfdd6d6a4975c903d8ca0ebfb4fa917d543289136ea0ab740cb47d2510c1 --- Makefile.in | 6 +----- auto.def | 16 ++++++++++++---- main.mk | 7 ++++--- manifest | 18 +++++++++--------- manifest.uuid | 2 +- 5 files changed, 27 insertions(+), 22 deletions(-) diff --git a/Makefile.in b/Makefile.in index 390e707478..7bb0d80b5b 100644 --- a/Makefile.in +++ b/Makefile.in @@ -153,6 +153,7 @@ LDFLAGS.dlopen = @LDFLAGS_DLOPEN@ LDFLAGS.readline = @LDFLAGS_READLINE@ CFLAGS.readline = @CFLAGS_READLINE@ LDFLAGS.icu = @LDFLAGS_ICU@ +CFLAGS.icu = @CFLAGS_ICU@ LDFLAGS.soname.libsqlite3 = @LDFLAGS_SONAME_LIBSQLITE3@ ENABLE_SHARED = @ENABLE_SHARED@ ENABLE_STATIC = @ENABLE_STATIC@ @@ -168,11 +169,6 @@ T.cc.sqlite = $(T.cc) @TARGET_DEBUG@ # all builds. # T.cc.sqlite += -D_HAVE_SQLITE_CONFIG_H -DBUILD_sqlite -# -# -I$(prefix)/include is primarily so that the ICU -# headers can be found. -# -T.cc.sqlite += -I$(prefix)/include # # $(JIMSH) and $(CFLAGS.jimsh) are documented in main.mk. $(JIMSH) diff --git a/auto.def b/auto.def index 90f11f1ee9..f8d0758ead 100644 --- a/auto.def +++ b/auto.def @@ -182,7 +182,9 @@ set flags { # with-icu-ldflags:LDFLAGS => {Enable SQLITE_ENABLE_ICU and add the given linker flags for the ICU libraries} - with-icu-config:=auto => {Enable SQLITE_ENABLE_ICU and fetch linker flags from the given icu-config binary} + with-icu-cflags:CFLAGS + => {Apply extra CFLAGS/CPPFLAGS necessary for building with ICU. e.g. -I/usr/local/include} + with-icu-config:=auto => {Enable SQLITE_ENABLE_ICU and fetch ldflags and cflags flags from the given icu-config binary} icu-collations=0 => {Enable SQLITE_ENABLE_ICU_COLLATIONS. Requires --with-icu-ldflags=... or --with-icu-config} # # @@ -362,6 +364,7 @@ proc sqlite-check-wasi-sdk {} { with-emsdk with-icu-config with-icu-ldflags + with-icu-cflags with-linenoise with-tcl } { @@ -1122,6 +1125,7 @@ proj-if-opt-truthy math { # Handles these flags: # # --with-icu-ldflags=LDFLAGS +# --with-icu-cflags=CFLAGS # --with-icu-config[=/path/to/icu-config] # --enable-icu-collations # @@ -1134,6 +1138,7 @@ proj-if-opt-truthy math { # opt-in feature. proc sqlite-check-icu {} { define LDFLAGS_ICU [join [opt-val with-icu-ldflags ""]] + define CFLAGS_ICU [join [opt-val with-icu-cflags ""]] # Flags sets seen in the wild for ICU: # - -licui18n -licuuc -licudata # - -licui18n -licuuc @@ -1155,14 +1160,17 @@ proc sqlite-check-icu {} { proj-fatal "$bin --ldflags returned no data" } define-append LDFLAGS_ICU $x + set x [exec $bin --cppflags] + define-append CFLAGS_ICU $x } else { proj-fatal "--with-icu-config=$bin does not refer to an executable" } } - set flags [define LDFLAGS_ICU [string trim [get-define LDFLAGS_ICU]]] - if {"" ne $flags} { + set ldflags [define LDFLAGS_ICU [string trim [get-define LDFLAGS_ICU]]] + set cflags [define CFLAGS_ICU [string trim [get-define CFLAGS_ICU]]] + if {"" ne $ldflags} { sqlite-add-feature-flag -shell -DSQLITE_ENABLE_ICU - msg-result "Enabling ICU support with libs: $flags" + msg-result "Enabling ICU support with libs ($ldflags) and cflags ($cflags)" if {[opt-bool icu-collations]} { msg-result "Enabling ICU collations." sqlite-add-feature-flag -shell -DSQLITE_ENABLE_ICU_COLLATIONS diff --git a/main.mk b/main.mk index 61e0514822..b6a18e14bc 100644 --- a/main.mk +++ b/main.mk @@ -162,6 +162,7 @@ LDFLAGS.pthread ?= -lpthread LDFLAGS.dlopen ?= -ldl LDFLAGS.shobj ?= -shared LDFLAGS.icu ?= # -licui18n -licuuc -licudata +CFLAGS.icu ?= LDFLAGS.soname.libsqlite3 ?= # libreadline (or a workalike): # To activate readline in the shell: SHELL_OPT = -DHAVE_READLINE=1 @@ -1922,7 +1923,7 @@ xbin: threadtest5 sqlite3$(T.exe): shell.c sqlite3.c $(T.link) -o $@ \ shell.c sqlite3.c \ - $(CFLAGS.readline) $(SHELL_OPT) \ + $(CFLAGS.readline) $(SHELL_OPT) $(CFLAGS.icu) \ $(LDFLAGS.libsqlite3) $(LDFLAGS.readline) # The "sqlite3d" CLI is build using separate source files. This @@ -2137,7 +2138,7 @@ shell.c: $(SHELL_DEP) $(TOP)/tool/mkshellc.tcl $(B.tclsh) # has_tclsh84 # DEPS_EXT_COMMON = $(DEPS_OBJ_COMMON) $(EXTHDR) icu.o: $(TOP)/ext/icu/icu.c $(DEPS_EXT_COMMON) - $(T.cc.extension) -c $(TOP)/ext/icu/icu.c + $(T.cc.extension) -c $(TOP)/ext/icu/icu.c $(CFLAGS.icu) fts3.o: $(TOP)/ext/fts3/fts3.c $(DEPS_EXT_COMMON) $(T.cc.extension) -c $(TOP)/ext/fts3/fts3.c @@ -2152,7 +2153,7 @@ fts3_hash.o: $(TOP)/ext/fts3/fts3_hash.c $(DEPS_EXT_COMMON) $(T.cc.extension) -c $(TOP)/ext/fts3/fts3_hash.c fts3_icu.o: $(TOP)/ext/fts3/fts3_icu.c $(DEPS_EXT_COMMON) - $(T.cc.extension) -c $(TOP)/ext/fts3/fts3_icu.c + $(T.cc.extension) -c $(TOP)/ext/fts3/fts3_icu.c $(CFLAGS.icu) fts3_porter.o: $(TOP)/ext/fts3/fts3_porter.c $(DEPS_EXT_COMMON) $(T.cc.extension) -c $(TOP)/ext/fts3/fts3_porter.c diff --git a/manifest b/manifest index 73fd9d1401..dfd8873d8e 100644 --- a/manifest +++ b/manifest @@ -1,9 +1,9 @@ -C Add\snew\smakefile\starget\s"sqlite3d"\s(where\sthe\s"d"\smeans\seither\s"development"\sor\n"debug")\sthat\salways\suses\sseparate\ssource\sfiles,\sregardless\sof\sthe\s\n--disable-amalgmation\ssetting. -D 2024-11-14T19:06:00.821 +C Remove\s$prefix/include\sfrom\sthe\sdefault\s-I\spath\sbecause\sit\scan\scause\sthe\sbuild\sto\spick\sup\san\sunintended\scopy\sof\ssqlite3.h.\sExtend\sthe\sICU\sconfigure\ssupport\s(the\sorigin\sof\s-I$prefix/include)\sto\senable\sfetching\sthe\s-I\spath\sfrom\sicu-config\sand\sapply\sit\sonly\sto\sthose\sobjects\swhich\sneed\sit. +D 2024-11-14T19:25:23.540 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d -F Makefile.in d941328627467c1bc2f13861b0bf5dc1e0c4669c072eec20b37285777f41d289 +F Makefile.in 6b8dd4c654bd0bddc2ac4d38e57521482896ebc6249a1a445a180100bc60826f F Makefile.linux-generic bd3e3cacd369821a6241d4ea1967395c962dfe3057e38cb0a435cee0e8b789d0 F Makefile.msc a92237976eb92c5efaa0dd2524746aec12c196e12df8d4dbff9543a4648c3312 F README.md c3c0f19532ce28f6297a71870f3c7b424729f0e6d9ab889616d3587dd2332159 @@ -13,7 +13,7 @@ F art/icon-80x90.gif 65509ce3e5f86a9cd64fe7fca2d23954199f31fe44c1e09e208c80fb83d F art/sqlite370.eps aa97a671332b432a54e1d74ff5e8775be34200c2 F art/sqlite370.ico af56c1d00fee7cd4753e8631ed60703ed0fc6e90 F art/sqlite370.jpg d512473dae7e378a67e28ff96a34da7cb331def2 -F auto.def 0201703bd03a1e998646f47e8ca0c7b89a219ff2ab87139fdfc34b820d230981 +F auto.def f40c5130bb6a719439300c4e186cd77ebc6cfd6b9c78f65eee8978fbcb26bd05 F autoconf/INSTALL 83e4a25da9fd053c7b3665eaaaf7919707915903 F autoconf/Makefile.am adedc1324b6a87fdd1265ddd336d2fb7d4f36a0e77b86ea553ae7cc4ea239347 F autoconf/Makefile.fallback 22fe523eb36dfce31e0f6349f782eb084e86a5620b2b0b4f84a2d6133f53f5ac @@ -696,7 +696,7 @@ F ext/wasm/tests/opfs/concurrency/test.js d08889a5bb6e61937d0b8cbb78c9efbefbf65a F ext/wasm/tests/opfs/concurrency/worker.js 0a8c1a3e6ebb38aabbee24f122693f1fb29d599948915c76906681bb7da1d3d2 F ext/wasm/wasmfs.make bc8bb227f35d5bd3863a7bd2233437c37472a0d81585979f058f9b9b503bef35 F magic.txt 5ade0bc977aa135e79e3faaea894d5671b26107cc91e70783aa7dc83f22f3ba0 -F main.mk 51e0eb180616a4863865e785bab5a4687326df5e9c0be3ab6005b775bd292f5b +F main.mk b50bf0907d551b9596d0e4ce1e74c2179885364b87eb921fcf685521cba8d335 F mptest/config01.test 3c6adcbc50b991866855f1977ff172eb6d901271 F mptest/config02.test 4415dfe36c48785f751e16e32c20b077c28ae504 F mptest/crash01.test 61e61469e257df0850df4293d7d4d6c2af301421 @@ -2198,8 +2198,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P ea79c363a42484357ac4ac3422f3466e5bc5cb56e5b2a06a3dc4ec90fea1c190 -R f73cd6f3e9db5bb5c6986a07c9399aad -U drh -Z 85bc26d605e98ed3bdc053f173922b85 +P 91da205beb7e5cab7a76be98e4cfddc4fb4c07022825ea645bc97f331c6bcdaa +R da94ff57aef6138935557e3d7da83893 +U stephan +Z 872305027d80572ab04100d3a42a5fa3 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 5bc74f1324..e41db9ab1c 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -91da205beb7e5cab7a76be98e4cfddc4fb4c07022825ea645bc97f331c6bcdaa +f778dfdd6d6a4975c903d8ca0ebfb4fa917d543289136ea0ab740cb47d2510c1