1 From a28f9aaab759d82384279c16d86bb98ab47412a3 Mon Sep 17 00:00:00 2001
2 From: Georgy Yakovlev <gyakovlev@gentoo.org>
3 Date: Sat, 1 Jun 2019 00:12:55 -0700
4 Subject: [PATCH] respect user cflags
7 buildSrc/linux.gradle | 7 ++++++-
8 .../gstreamer/projects/linux/avplugin/Makefile | 16 ++++++----------
9 .../gstreamer/projects/linux/fxplugins/Makefile | 17 ++++++-----------
10 .../projects/linux/gstreamer-lite/Makefile | 16 ++++++----------
11 .../native/jfxmedia/projects/linux/Makefile | 16 ++++++----------
12 5 files changed, 30 insertions(+), 42 deletions(-)
14 diff --git a/buildSrc/linux.gradle b/buildSrc/linux.gradle
15 index 7a7cbc72..6705a0f3 100644
16 --- a/buildSrc/linux.gradle
17 +++ b/buildSrc/linux.gradle
18 @@ -44,8 +44,11 @@ LINUX.library = { name -> return "lib${name}.so" as String }
20 "-fno-strict-aliasing", "-fPIC", "-fno-omit-frame-pointer", // optimization flags
22 + "-Wno-error=cast-function-type",
23 "-Wextra", "-Wall", "-Wformat-security", "-Wno-unused", "-Wno-parentheses", "-Werror=trampolines"] // warning flags
25 +commonFlags.addAll(System.getenv("CFLAGS").trim().split(" "))
30 @@ -61,6 +64,8 @@ def linkFlags = ["-static-libgcc", "-static-libstdc++", "-shared", commonFlags,
32 "-Wl,--gc-sections"].flatten()
34 +linkFlags.addAll(System.getenv("LDFLAGS").trim().split(" "))
36 if (IS_DEBUG_NATIVE) {
39 @@ -294,7 +299,7 @@ LINUX.iio.nativeSource = [
40 LINUX.iio.compiler = compiler
41 LINUX.iio.ccFlags = [cFlags, "-fvisibility=hidden"].flatten()
42 LINUX.iio.linker = IS_STATIC_BUILD ? "ld" : linker
43 -LINUX.iio.linkFlags = [linkFlags].flatten()
44 +LINUX.iio.linkFlags = [linkFlags, "-ljpeg"].flatten()
45 LINUX.iio.lib = "javafx_iio"
48 diff --git a/modules/javafx.media/src/main/native/gstreamer/projects/linux/avplugin/Makefile b/modules/javafx.media/src/main/native/gstreamer/projects/linux/avplugin/Makefile
49 index 450b55d3..f27b9479 100644
50 --- a/modules/javafx.media/src/main/native/gstreamer/projects/linux/avplugin/Makefile
51 +++ b/modules/javafx.media/src/main/native/gstreamer/projects/linux/avplugin/Makefile
52 @@ -17,7 +17,7 @@ TARGET = $(BUILD_DIR)/lib$(BASE_NAME).so
53 OBJBASE_DIR = $(BUILD_DIR)/obj/plugins/avplugin
61 @@ -29,13 +29,8 @@ CFLAGS = -fPIC \
63 -DGST_DISABLE_LOADSAVE \
65 - -ffunction-sections -fdata-sections
67 -ifeq ($(BUILD_TYPE), Release)
72 + -ffunction-sections -fdata-sections \
75 PACKAGES_INCLUDES := $(shell pkg-config --cflags glib-2.0)
76 PACKAGES_LIBS := $(shell pkg-config --libs glib-2.0 gobject-2.0)
77 @@ -46,11 +41,12 @@ INCLUDES= -I../../../plugins \
78 -I../../../gstreamer-lite/gstreamer/libs \
81 -LDFLAGS = -L$(BUILD_DIR) \
82 +LDFLAGS := -L$(BUILD_DIR) \
86 - -static-libgcc -static-libstdc++ -Wl,--gc-sections
87 + -static-libgcc -static-libstdc++ -Wl,--gc-sections \
90 ifneq ($(strip $(LIBAV_DIR)),)
91 INCLUDES += -I$(LIBAV_DIR)/include
92 diff --git a/modules/javafx.media/src/main/native/gstreamer/projects/linux/fxplugins/Makefile b/modules/javafx.media/src/main/native/gstreamer/projects/linux/fxplugins/Makefile
93 index 1e58d4d3..627865f9 100644
94 --- a/modules/javafx.media/src/main/native/gstreamer/projects/linux/fxplugins/Makefile
95 +++ b/modules/javafx.media/src/main/native/gstreamer/projects/linux/fxplugins/Makefile
96 @@ -14,7 +14,7 @@ DIRLIST = progressbuffer \
98 TARGET = $(BUILD_DIR)/lib$(BASE_NAME).so
105 @@ -30,14 +30,8 @@ CFLAGS = -fPIC \
106 -DGST_DISABLE_LOADSAVE \
107 -DGST_DISABLE_GST_DEBUG \
109 - -ffunction-sections -fdata-sections
111 -ifeq ($(BUILD_TYPE), Release)
117 + -ffunction-sections -fdata-sections \
120 INCLUDES = -I$(SRCBASE_DIR) \
121 $(addprefix -I$(SRCBASE_DIR)/,$(DIRLIST)) \
122 @@ -47,9 +41,10 @@ INCLUDES = -I$(SRCBASE_DIR) \
123 PACKAGES_INCLUDES := $(shell pkg-config --cflags glib-2.0)
124 PACKAGES_LIBS := $(shell pkg-config --libs glib-2.0 gobject-2.0)
126 -LDFLAGS = -L$(BUILD_DIR) -lgstreamer-lite $(PACKAGES_LIBS) \
127 +LDFLAGS := -L$(BUILD_DIR) -lgstreamer-lite $(PACKAGES_LIBS) \
129 - -static-libgcc -static-libstdc++ -Wl,--gc-sections
130 + -static-libgcc -static-libstdc++ -Wl,--gc-sections \
135 diff --git a/modules/javafx.media/src/main/native/gstreamer/projects/linux/gstreamer-lite/Makefile b/modules/javafx.media/src/main/native/gstreamer/projects/linux/gstreamer-lite/Makefile
136 index 5baa30a1..ddf0e521 100644
137 --- a/modules/javafx.media/src/main/native/gstreamer/projects/linux/gstreamer-lite/Makefile
138 +++ b/modules/javafx.media/src/main/native/gstreamer/projects/linux/gstreamer-lite/Makefile
139 @@ -37,7 +37,7 @@ DIRLIST = gstreamer/gst \
141 TARGET = $(BUILD_DIR)/lib$(BASE_NAME).so
148 @@ -51,13 +51,8 @@ CFLAGS =-fPIC \
150 -DGST_DISABLE_GST_DEBUG \
151 -DGST_DISABLE_LOADSAVE \
152 - -ffunction-sections -fdata-sections
154 -ifeq ($(BUILD_TYPE), Release)
159 + -ffunction-sections -fdata-sections \
162 INCLUDES = -I$(BASE_DIR)/plugins \
163 -I$(SRCBASE_DIR)/projects/build/linux/common \
164 @@ -75,9 +70,10 @@ INCLUDES = -I$(BASE_DIR)/plugins \
165 PACKAGES_INCLUDES := $(shell pkg-config --cflags alsa glib-2.0)
166 PACKAGES_LIBS := $(shell pkg-config --libs alsa glib-2.0 gobject-2.0 gmodule-2.0 gthread-2.0)
168 -LDFLAGS = -L$(BUILD_DIR) -lm $(PACKAGES_LIBS) \
169 +LDFLAGS := -L$(BUILD_DIR) -lm $(PACKAGES_LIBS) \
171 - -static-libgcc -static-libstdc++ -Wl,--gc-sections
172 + -static-libgcc -static-libstdc++ -Wl,--gc-sections \
177 diff --git a/modules/javafx.media/src/main/native/jfxmedia/projects/linux/Makefile b/modules/javafx.media/src/main/native/jfxmedia/projects/linux/Makefile
178 index ecbd859f..5881cf53 100644
179 --- a/modules/javafx.media/src/main/native/jfxmedia/projects/linux/Makefile
180 +++ b/modules/javafx.media/src/main/native/jfxmedia/projects/linux/Makefile
181 @@ -17,7 +17,7 @@ DIRLIST = jni \
183 TARGET = $(BUILD_DIR)/lib$(BASE_NAME).so
185 -CFLAGS = -DTARGET_OS_LINUX=1 \
186 +CFLAGS := -DTARGET_OS_LINUX=1 \
188 -DGST_REMOVE_DEPRECATED \
189 -DGST_DISABLE_GST_DEBUG \
190 @@ -26,7 +26,8 @@ CFLAGS = -DTARGET_OS_LINUX=1 \
192 -DJFXMEDIA_JNI_EXPORTS \
194 - -ffunction-sections -fdata-sections
195 + -ffunction-sections -fdata-sections \
198 CPPFLAGS = -fno-rtti -ffunction-sections -fdata-sections
200 @@ -56,21 +57,16 @@ ifdef HOST_COMPILE
201 -I$(GSTREAMER_LITE_DIR)/gstreamer/libs \
204 - LDFLAGS = -Wl,-rpath,\$$ORIGIN -L$(BUILD_DIR) -lgstreamer-lite $(PACKAGES_LIBS) \
205 + LDFLAGS := -Wl,-rpath,\$$ORIGIN -L$(BUILD_DIR) -lgstreamer-lite $(PACKAGES_LIBS) \
207 - -static-libgcc -static-libstdc++ -Wl,--gc-sections
208 + -static-libgcc -static-libstdc++ -Wl,--gc-sections \
211 CFLAGS += $(EXTRA_CFLAGS)
212 INCLUDES = $(BASE_INCLUDES)
213 LDFLAGS = -Wl,-rpath,\$$ORIGIN -L$(BUILD_DIR) $(EXTRA_LDFLAGS)
216 -ifeq ($(BUILD_TYPE), Release)
219 - CFLAGS += -g -Wall -D_DEBUG