|
36 | 36 | CouchJSPath = filename:join(["priv", CouchJSName]). |
37 | 37 | Version = case os:getenv("COUCHDB_VERSION") of |
38 | 38 | false -> |
39 | | - string:strip(os:cmd("git describe --always"), right, $\n); |
| 39 | + string:trim(os:cmd("git describe --always")); |
40 | 40 | Version0 -> |
41 | | - string:strip(Version0, right) |
| 41 | + string:trim(Version0) |
42 | 42 | end. |
43 | 43 |
|
44 | 44 | GitSha = case os:getenv("COUCHDB_GIT_SHA") of |
45 | 45 | false -> |
46 | 46 | ""; % release builds won\'t get a fallback |
47 | 47 | GitSha0 -> |
48 | | - string:strip(GitSha0, right) |
| 48 | + string:trim(GitSha0) |
49 | 49 | end. |
50 | 50 |
|
51 | 51 | CouchConfig = case filelib:is_file(os:getenv("COUCHDB_CONFIG")) of |
@@ -151,6 +151,25 @@ ProperConfig = case code:lib_dir(proper) of |
151 | 151 | _ -> [{d, 'WITH_PROPER'}] |
152 | 152 | end. |
153 | 153 |
|
| 154 | +DpkgArchitectureCmd = "dpkg-architecture -q DEB_HOST_MULTIARCH". |
| 155 | +GenericMozJSIncludePaths = "-I/usr/include/mozjs-" ++ SMVsn ++ " -I/usr/local/include/mozjs-" ++ SMVsn. |
| 156 | +GenericMozJSLibPaths = "-L/usr/local/lib -L/opt/homebrew/lib". |
| 157 | + |
| 158 | +WithDpkgArchitecture = case os:find_executable("dpkg-architecture") of |
| 159 | + false -> false; |
| 160 | + _ -> true |
| 161 | +end. |
| 162 | + |
| 163 | +MozJSIncludePath = case WithDpkgArchitecture of |
| 164 | + false -> GenericMozJSIncludePaths; |
| 165 | + true -> GenericMozJSIncludePaths ++ " -I/usr/include/" ++ string:trim(os:cmd(DpkgArchitectureCmd)) ++ "/mozjs-" ++ SMVsn |
| 166 | +end. |
| 167 | + |
| 168 | +MozJSLibPath = case WithDpkgArchitecture of |
| 169 | + false -> GenericMozJSLibPaths; |
| 170 | + true -> GenericMozJSLibPaths ++ " -L/usr/lib/" ++ string:trim(os:cmd(DpkgArchitectureCmd)) |
| 171 | +end. |
| 172 | + |
154 | 173 | % The include directories (parameters for the `-I` C compiler flag) are |
155 | 174 | % considered in the `configure` script as a pre-check for their existence. |
156 | 175 | % Please keep them in sync. |
@@ -195,45 +214,20 @@ end. |
195 | 214 | "-DXP_UNIX -I/usr/include/mozjs-86 -I/usr/local/include/mozjs-86 -I/opt/homebrew/include/mozjs-86/ -std=c++17 -Wno-invalid-offsetof", |
196 | 215 | "-L/usr/local/lib -L /opt/homebrew/lib/ -std=c++17 -lmozjs-86 -lm" |
197 | 216 | }; |
198 | | - {unix, _} when SMVsn == "91" -> |
199 | | - { |
200 | | - "$CFLAGS -DXP_UNIX -I/usr/include/mozjs-91 -I/usr/local/include/mozjs-91 -I/opt/homebrew/include/mozjs-91/ -std=c++17 -Wno-invalid-offsetof", |
201 | | - "$LDFLAGS -L/usr/local/lib -L /opt/homebrew/lib/ -std=c++17 -lmozjs-91 -lm" |
202 | | - }; |
203 | | - {unix, _} when SMVsn == "102" -> |
204 | | - { |
205 | | - "$CFLAGS -DXP_UNIX -I/usr/include/mozjs-102 -I/usr/local/include/mozjs-102 -I/opt/homebrew/include/mozjs-102/ -std=c++17 -Wno-invalid-offsetof", |
206 | | - "$LDFLAGS -L/usr/local/lib -L /opt/homebrew/lib/ -std=c++17 -lmozjs-102 -lm" |
207 | | - }; |
208 | | - {unix, _} when SMVsn == "115" -> |
209 | | - { |
210 | | - "$CFLAGS -DXP_UNIX -I/usr/include/mozjs-115 -I/usr/local/include/mozjs-115 -I/opt/homebrew/include/mozjs-115/ -std=c++17 -Wno-invalid-offsetof", |
211 | | - "$LDFLAGS -L/usr/local/lib -L /opt/homebrew/lib/ -std=c++17 -lmozjs-115 -lm" |
212 | | - }; |
213 | | - {unix, _} when SMVsn == "128" -> |
| 217 | + {unix, _} when SMVsn == "91"; SMVsn == "102"; SMVsn == "115"; SMVsn == "128" -> |
214 | 218 | { |
215 | | - "$CFLAGS -DXP_UNIX -I/usr/include/mozjs-128 -I/usr/local/include/mozjs-128 -I/opt/homebrew/include/mozjs-128/ -std=c++17 -Wno-invalid-offsetof", |
216 | | - "$LDFLAGS -L/usr/local/lib -L /opt/homebrew/lib/ -std=c++17 -lmozjs-128 -lm" |
| 219 | + "$CFLAGS -DXP_UNIX " ++ MozJSIncludePath ++ " -std=c++17 -Wno-invalid-offsetof", |
| 220 | + "$LDFLAGS " ++ MozJSLibPath ++ " -std=c++17 -lm -lmozjs-" ++ SMVsn |
217 | 221 | }; |
218 | 222 | {win32, _} when SMVsn == "91" -> |
219 | 223 | { |
220 | 224 | "/std:c++17 /DXP_WIN", |
221 | 225 | "$LDFLAGS mozjs-91.lib" |
222 | 226 | }; |
223 | | - {win32, _} when SMVsn == "102" -> |
224 | | - { |
225 | | - "/std:c++17 /DXP_WIN /Zc:preprocessor /utf-8", |
226 | | - "$LDFLAGS mozjs-102.lib" |
227 | | - }; |
228 | | - {win32, _} when SMVsn == "115" -> |
229 | | - { |
230 | | - "/std:c++17 /DXP_WIN /Zc:preprocessor /utf-8", |
231 | | - "$LDFLAGS mozjs-115.lib" |
232 | | - }; |
233 | | - {win32, _} when SMVsn == "128" -> |
| 227 | + {win32, _} when SMVsn == "102"; SMVsn == "115"; SMVsn == "128" -> |
234 | 228 | { |
235 | 229 | "/std:c++17 /DXP_WIN /Zc:preprocessor /utf-8", |
236 | | - "$LDFLAGS mozjs-128.lib" |
| 230 | + "$LDFLAGS mozjs-" ++ SMVsn ++ ".lib" |
237 | 231 | } |
238 | 232 | end. |
239 | 233 |
|
@@ -273,12 +267,12 @@ end. |
273 | 267 |
|
274 | 268 | IcuIncludePath = case WithBrew of |
275 | 269 | false -> GenericIcuIncludePaths; |
276 | | - true -> "-I" ++ string:strip(os:cmd(BrewIcuPrefixCmd), right, $\n) ++ "/include" |
| 270 | + true -> "-I" ++ string:trim(os:cmd(BrewIcuPrefixCmd)) ++ "/include" |
277 | 271 | end. |
278 | 272 |
|
279 | 273 | IcuLibPath = case WithBrew of |
280 | 274 | false -> GenericIcuLibPaths; |
281 | | - true -> "-L" ++ string:strip(os:cmd(BrewIcuPrefixCmd), right, $\n) ++ "/lib" |
| 275 | + true -> "-L" ++ string:trim(os:cmd(BrewIcuPrefixCmd)) ++ "/lib" |
282 | 276 | end. |
283 | 277 |
|
284 | 278 | IcuEnv = [{"DRV_CFLAGS", "$DRV_CFLAGS -DPIC -O2 -fno-common"}, |
|
0 commit comments