Respect build environment settings

Bug: https://bugs.gentoo.org/913186
Bug: https://bugs.gentoo.org/913188
Bug: https://bugs.gentoo.org/913189


--- a/7zip_gcc.mak
+++ b/7zip_gcc.mak
@@ -87,14 +87,14 @@ SHARED_EXT=.dll
 LDFLAGS = -shared -DEF $(DEF_FILE) $(LDFLAGS_STATIC)
 else
 SHARED_EXT=.so
-LDFLAGS = -shared -fPIC $(LDFLAGS_STATIC)
+LDFLAGS = -shared -fPIC $(G_LDFLAGS) $(LDFLAGS_STATIC)
 CC_SHARED=-fPIC
 endif


 else

-LDFLAGS = $(LDFLAGS_STATIC)
+LDFLAGS = $(LDFLAGS_STATIC) $(G_LDFLAGS)
 # -s is not required for clang, do we need it for GCC ???

 #-static -static-libgcc -static-libstdc++
@@ -149,7 +149,7 @@ endif



-CFLAGS = $(MY_ARCH_2) $(LOCAL_FLAGS) $(CFLAGS_BASE2) $(CFLAGS_BASE) $(FLAGS_FLTO) $(CC_SHARED) -o $@
+CFLAGS = $(MY_ARCH_2) $(LOCAL_FLAGS) $(CFLAGS_BASE2) $(CFLAGS_BASE) $(FLAGS_FLTO) $(CC_SHARED) $(G_CFLAGS) -o $@


 ifdef IS_MINGW
@@ -190,7 +190,7 @@ CXX_WARN_FLAGS =
 #-Wno-invalid-offsetof
 #-Wno-reorder

-CXXFLAGS = $(MY_ARCH_2) $(LOCAL_FLAGS) $(CXXFLAGS_BASE2) $(CFLAGS_BASE) $(FLAGS_FLTO) $(CXXFLAGS_EXTRA) $(CC_SHARED) $(CXX_WARN_FLAGS) $(CXX_STD_FLAGS) -o $@
+CXXFLAGS = $(MY_ARCH_2) $(LOCAL_FLAGS) $(CXXFLAGS_BASE2) $(CFLAGS_BASE) $(FLAGS_FLTO) $(CXXFLAGS_EXTRA) $(CC_SHARED) $(CXX_WARN_FLAGS) $(CXX_STD_FLAGS) $(G_CXXFLAGS) -o $@

 STATIC_TARGET=
 ifdef COMPL_STATIC
@@ -208,7 +208,7 @@ $(O):
 # -Wl,--print-gc-sections

 ifneq ($(CC), $(CROSS_COMPILE)clang)
-LFLAGS_STRIP = -s
+
 endif

 LFLAGS_ALL = $(LFLAGS_STRIP) $(MY_ARCH_2) $(LDFLAGS) $(FLAGS_FLTO) $(LD_arch) $(OBJS) $(MY_LIBS) $(LIB2)
