Skip to content

Commit e2d3b0b

Browse files
author
Alan Jeffrey
committed
Allow setting build flags from cargo
1 parent 9f8a2d7 commit e2d3b0b

File tree

2 files changed

+27
-9
lines changed

2 files changed

+27
-9
lines changed

build.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -197,9 +197,7 @@ fn build_jsapi_bindings() {
197197

198198
if let Ok(flags) = env::var("CXXFLAGS") {
199199
for flag in flags.split_whitespace() {
200-
if !flag.starts_with("--sysroot") {
201-
builder = builder.clang_arg(flag);
202-
}
200+
builder = builder.clang_arg(flag);
203201
}
204202
}
205203

makefile.cargo

+26-6
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,27 @@ ifneq ($(HOST),$(TARGET))
2222
endif
2323

2424
ifeq (android,$(findstring android,$(TARGET)))
25-
CONFIGURE_FLAGS += \
26-
--with-android-ndk=$(ANDROID_NDK) \
27-
--with-android-toolchain=$(ANDROID_TOOLCHAIN) \
28-
--with-android-version=$(NDK_ANDROID_VERSION) \
29-
$(NULL)
25+
ifneq (,$(STLPORT_CPPFLAGS))
26+
CONFIGURE_FLAGS += STLPORT_CPPFLAGS="$(STLPORT_CPPFLAGS)"
27+
endif
28+
ifneq (,$(ANDROID_NDK))
29+
CONFIGURE_FLAGS += --with-android-ndk=$(ANDROID_NDK)
30+
endif
31+
ifneq (,$(ANDROID_NDK_VERSION))
32+
CONFIGURE_FLAGS += --with-android-ndk-version=$(ANDROID_NDK_VERSION)
33+
endif
34+
ifneq (,$(ANDROID_VERSION))
35+
CONFIGURE_FLAGS += --with-android-version=$(ANDROID_VERSION)
36+
endif
37+
ifneq (,$(ANDROID_PLATFORM_DIR))
38+
CONFIGURE_FLAGS += --with-android-platform=$(ANDROID_PLATFORM_DIR)
39+
endif
40+
ifneq (,$(ANDROID_TOOLCHAIN_DIR))
41+
CONFIGURE_FLAGS += --with-android-toolchain=$(ANDROID_TOOLCHAIN_DIR)
42+
endif
43+
ifneq (,$(ANDROID_CLANG))
44+
CONFIGURE_FLAGS += --with-android-clang=$(ANDROID_CLANG)
45+
endif
3046
endif
3147

3248
CC ?= $(TARGET)-gcc
@@ -143,6 +159,10 @@ maybe-configure:
143159
if [[ $(JSSRC)/configure -nt $(OUT_DIR)/config.status ]] ; then \
144160
cd $(OUT_DIR) && \
145161
PYTHON="$(PYTHON)" MOZ_TOOLS="$(MOZ_TOOLS)" \
146-
CC="$(CC)" CPP="$(CPP)" CXX="$(CXX)" AR="$(AR)" \
162+
CC="$(CC)" CFLAGS="$(CFLAGS)" \
163+
CPP="$(CPP)" CPPFLAGS="$(CPPFLAGS)" \
164+
CXX="$(CXX)" CXXFLAGS="$(CXXFLAGS)" \
165+
AS="$(AS)" AR="$(AR)" \
166+
STLPORT_LIBS="$(STLPORT_LIBS)" \
147167
$(JSSRC)/configure $(strip $(CONFIGURE_FLAGS)) || (cat config.log && exit 1) ; \
148168
fi

0 commit comments

Comments
 (0)