On Wed 26/08/2020 15:17, Bjorn Ketelaars wrote:
> I have the diff below sitting in my tree for a couple of weeks:
> 
> As sthen@ explained [0]: "COMPILER=base-clang ports-gcc" is needed by
> archiver/zstd because of -Wvla in a couple of Makefiles. Fortunate this
> is easily patched out. While here:
> - switch ALL_TARGET to 'default' as 'allmost' builds stuff that we do
>   not package. This saves a couple of seconds while building;
> - No need for WANTLIB+=atomic/LDFLAGS+=-latomic (hppa only). There is
>   nothing related to atomics in the stuff that is build (related to
>   ALL_TARGET);
> - No need to set CXX* in MAKE_ENV as the build is C-only;
> - No need to set CFLAGS. Upstream's (GNU)Makefile properly amends CFLAGS
>   on a per-target basis. We already provide CFLAGS through MAKE_ENV, let
>   the Makefile do its job;
> - Update CPPFLAGS.
> 
> Builds successfully using either clang or gcc4. All tests are OK.
> 
> This diff needs to be tested on hppa. Unfortunately I have no access to
> this arch. Anyone willing to test?
> 
> Comments/OK?

Ping...

Diff enclosed for your convenience:


diff --git Makefile Makefile
index 231f0a93d6c..782ee6b9655 100644
--- Makefile
+++ Makefile
@@ -3,6 +3,7 @@
 COMMENT =              zstandard fast real-time compression algorithm
 
 V =                    1.4.5
+REVISION =             0
 DISTNAME =             zstd-${V}
 
 SHARED_LIBS =          zstd    3.2     # 1.4.5
@@ -24,29 +25,19 @@ LIB_DEPENDS =               archivers/lz4 \
                        archivers/xz
 BUILD_DEPENDS =                sysutils/ggrep
 
-COMPILER =             base-clang ports-gcc
-
 MAKE_ENV =             CC="${CC}" \
-                       CFLAGS="${CFLAGS}" \
-                       CPPFLAGS="-I${WRKSRC}/lib -I${WRKSRC}/lib/common 
-I${LOCALBASE}/include" \
-                       CXX="${CXX}" \
-                       CXXFLAGS="${CXXFLAGS}" \
+                       CPPFLAGS="-I${LOCALBASE}/include" \
                        LDFLAGS="${LDFLAGS} -L${LOCALBASE}/lib"
 MAKE_FLAGS =           SHARED_EXT_VER="so.$(LIBzstd_VERSION)" \
                        SONAME_FLAGS= \
                        V=1
 FAKE_FLAGS =           PREFIX="${PREFIX}"
 
-.if ${MACHINE_ARCH:Mhppa}
-WANTLIB +=             atomic
-LDFLAGS +=             -latomic
-.endif
-
 USE_GMAKE =            Yes
 
 DEBUG_PACKAGES =       ${BUILD_PACKAGES}
 
-ALL_TARGET =           allmost
+ALL_TARGET =           default
 TEST_TARGET =          check
 
 pre-build:
diff --git patches/patch-lib_Makefile patches/patch-lib_Makefile
index 48a5c2d802a..9d9f7f90115 100644
--- patches/patch-lib_Makefile
+++ patches/patch-lib_Makefile
@@ -1,8 +1,21 @@
 $OpenBSD: patch-lib_Makefile,v 1.8 2020/05/28 19:31:56 bket Exp $
 
+- Some compilers don't have -Wvla
+- Don't set compiler optimisation level
+- Don't create symbolic links to SHARED_LIB
+
 Index: lib/Makefile
 --- lib/Makefile.orig
 +++ lib/Makefile
+@@ -38,7 +38,7 @@ endif
+ DEBUGFLAGS= -Wall -Wextra -Wcast-qual -Wcast-align -Wshadow \
+             -Wstrict-aliasing=1 -Wswitch-enum -Wdeclaration-after-statement \
+             -Wstrict-prototypes -Wundef -Wpointer-arith \
+-            -Wvla -Wformat=2 -Winit-self -Wfloat-equal -Wwrite-strings \
++            -Wformat=2 -Winit-self -Wfloat-equal -Wwrite-strings \
+             -Wredundant-decls -Wmissing-prototypes -Wc++-compat
+ CFLAGS  += $(DEBUGFLAGS) $(MOREFLAGS)
+ FLAGS    = $(CPPFLAGS) $(CFLAGS)
 @@ -81,7 +81,7 @@ ifneq ($(ZSTD_LIB_MINIFY), 0)
        CFLAGS += -fno-stack-protector -fomit-frame-pointer -fno-ident \
                  -DDYNAMIC_BMI2=0 -DNDEBUG
diff --git patches/patch-programs_Makefile patches/patch-programs_Makefile
new file mode 100644
index 00000000000..d0dda7f7233
--- /dev/null
+++ patches/patch-programs_Makefile
@@ -0,0 +1,16 @@
+$OpenBSD$
+
+Some compilers don't have -Wvla
+
+Index: programs/Makefile
+--- programs/Makefile.orig
++++ programs/Makefile
+@@ -51,7 +51,7 @@ CFLAGS  ?= -O3
+ DEBUGFLAGS+=-Wall -Wextra -Wcast-qual -Wcast-align -Wshadow \
+             -Wstrict-aliasing=1 -Wswitch-enum -Wdeclaration-after-statement \
+             -Wstrict-prototypes -Wundef -Wpointer-arith \
+-            -Wvla -Wformat=2 -Winit-self -Wfloat-equal -Wwrite-strings \
++            -Wformat=2 -Winit-self -Wfloat-equal -Wwrite-strings \
+             -Wredundant-decls -Wmissing-prototypes -Wc++-compat
+ CFLAGS  += $(DEBUGFLAGS) $(MOREFLAGS)
+ FLAGS    = $(CPPFLAGS) $(CFLAGS) $(LDFLAGS)
diff --git patches/patch-tests_Makefile patches/patch-tests_Makefile
new file mode 100644
index 00000000000..fe60f9fb452
--- /dev/null
+++ patches/patch-tests_Makefile
@@ -0,0 +1,16 @@
+$OpenBSD$
+
+Some compilers don't have -Wvla
+
+Index: tests/Makefile
+--- tests/Makefile.orig
++++ tests/Makefile
+@@ -35,7 +35,7 @@ CFLAGS     ?= -O3
+ CFLAGS     += -Wall -Wextra -Wcast-qual -Wcast-align -Wshadow                 
\
+               -Wstrict-aliasing=1 -Wswitch-enum -Wdeclaration-after-statement 
\
+               -Wstrict-prototypes -Wundef                                     
\
+-              -Wvla -Wformat=2 -Winit-self -Wfloat-equal -Wwrite-strings      
\
++              -Wformat=2 -Winit-self -Wfloat-equal -Wwrite-strings      \
+               -Wredundant-decls -Wmissing-prototypes
+ CFLAGS     += $(DEBUGFLAGS) $(MOREFLAGS)
+ FLAGS       = $(CPPFLAGS) $(CFLAGS) $(LDFLAGS)

Reply via email to