Work around the lack of definition of union semun per POSIX.

When feasible do this by adding -D_WANT_SEMUN to CFLAGS or CXXFLAGS.
Where this fails due to ports not honoring C*FLAGS, patch using
__FreeBSD_version to enable the definition.

PR:		224300, 224443 (exp-run)
Approved by:	portmgr (antoine)
Exp-run:	antoine
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D14137
This commit is contained in:
Brooks Davis 2018-03-02 22:34:53 +00:00
parent 327f701df5
commit 16a06ea402
32 changed files with 152 additions and 0 deletions

View file

@ -23,6 +23,7 @@ INSTALL_TARGET= install-strip
TEST_ENV= ${MAKE_ENV} ALSA_CONFIG_PATH="${FILESDIR}/asound.conf.sample"
TEST_TARGET= check
CPPFLAGS+= -I${FILESDIR}
CPPFLAGS+= -D_WANT_SEMUN
OPTIONS_DEFINE= PYTHON
OPTIONS_SUB= yes

View file

@ -22,6 +22,7 @@ USE_CSTD= gnu89
MAKE_ARGS= CC="${CC}" \
CXX="${CXX}" \
PERLCOREDIR=${PERLCOREDIR}
CFLAGS+= -D_WANT_SEMUN
PERLCOREDIR= ${LOCALBASE}/lib/perl5/${PERL_VER}/${PERL_ARCH}/CORE

View file

@ -13,6 +13,8 @@ COMMENT= Wav player and recorder
LICENSE= GPLv2 # only
LICENSE_FILE= ${WRKSRC}/COPYING
CFLAGS+= -D_WANT_SEMUN
ONLY_FOR_ARCHS= amd64 armv6 armv7 i386
INSTALL_TARGET= install PREFIX="${STAGEDIR}${PREFIX}"

View file

@ -20,6 +20,8 @@ PLIST_SUB+= RELEASE=${OSREL:R:R} ARCH=${ARCH} OPSYS=${OPSYS}
SUB_FILES= pkg-message
PKGMESSAGE= ${WRKDIR}/pkg-message
CFLAGS+= -D_WANT_SEMUN
LIBBINDIR= ${STAGEDIR}${PREFIX}/lib/X11/xmcd/bin-${OPSYS}_${OSREL:R:R}-${ARCH}
BROKEN_aarch64= Fails to compile: many undefined symbols in xorg.cf

View file

@ -20,6 +20,7 @@ CONFIGURE_ARGS= --enable-ipv6 \
--disable-arts
CPPFLAGS+= -I${LOCALBASE}/include
CPPFLAGS+= -D_WANT_SEMUN
LDFLAGS+= -lpthread -L${LOCALBASE}/lib
OPTIONS_DEFINE= ESOUND VORBIS

View file

@ -15,6 +15,7 @@ LICENSE= GPLv2+
GNU_CONFIGURE= yes
CONFIGURE_ARGS= --with-smacks-dir=${DATADIR}
MAKE_JOBS_UNSAFE= yes
CPPFLAGS+= -D_WANT_SEMUN
PORTDOCS= CHANGES README MANUAL TUTORIAL

View file

@ -22,6 +22,7 @@ MAKE_ENV= OSTYPE="${OPSYS}"
MAKEFILE= makefile
USE_LDCONFIG= yes
DOS2UNIX_FILES= ${MAKEFILE}
CXXFLAGS+= -D_WANT_SEMUN
PORTDOCS= FastDB.htm

View file

@ -15,6 +15,7 @@ USE_CXXSTD= c++11
USE_GNOME= gtkmm24 gtksourceview libxml2
USE_XORG= x11
MAKE_JOBS_UNSAFE= yes
CXXFLAGS+= -D_WANT_SEMUN
.ifdef WITHOUT_SSL
MAKE_ARGS+= WITHOUT_SSL=yes

View file

@ -27,6 +27,7 @@ MAKEFILE= GNUmakefile
USE_LDCONFIG= yes
CPPFLAGS+= -I${LOCALBASE}/include
CPPFLAGS+= -D_WANT_SEMUN
LDFLAGS+= -L${LOCALBASE}/lib
PLIST_SUB= VERSION="${PORTVERSION}"

View file

@ -14,6 +14,7 @@ COMMENT= Collection of C modules potentially useful to any project
MAKE_JOBS_UNSAFE= yes
USE_LDCONFIG= yes
MAKE_ARGS= prefix="${STAGEDIR}${PREFIX}"
CFLAGS+= -D_WANT_SEMUN
post-patch:
@${REINPLACE_CMD} -e 's,-g,$$(CFLAGS),' \

View file

@ -16,5 +16,6 @@ USES= pathfix libtool
GNU_CONFIGURE= yes
CONFIGURE_ARGS+=--disable-lynx --disable-doxygen
INSTALL_TARGET= install-strip
CFLAGS+= -D_WANT_SEMUN
.include <bsd.port.mk>

View file

@ -18,6 +18,7 @@ CPE_PRODUCT= netscape_portable_runtime
WRKSRC_SUBDIR= nspr
GNU_CONFIGURE= yes
USE_LDCONFIG= yes
CFLAGS+= -D_WANT_SEMUN
OPTIONS_DEFINE= DEBUG TEST

View file

@ -25,6 +25,7 @@ USES= gmake tar:bzip2 ssl
HAS_CONFIGURE= yes
CONFIGURE_ARGS= --prefix=${PREFIX} --config=FreeBSD
USE_LDCONFIG= yes
CXXFLAGS+= -D_WANT_SEMUN
OPTIONS_DEFINE= TEST SAMPLES MYSQL SQLITE ODBC
OPTIONS_DEFAULT=MYSQL SQLITE

View file

@ -17,6 +17,7 @@ GNU_CONFIGURE= yes
CPPFLAGS+= -I${LOCALBASE}/include
LDFLAGS+= -L${LOCALBASE}/lib
USE_LDCONFIG= yes
CPPFLAGS+= -D_WANT_SEMUN
post-install:
${STRIP_CMD} ${STAGEDIR}${PREFIX}/lib/libshmap.so

View file

@ -131,6 +131,7 @@ PLIST_SUB+= STATIC=""
WITHOUT_CPU_CFLAGS=yes #to avoid problems with register allocation
CFLAGS:= ${CFLAGS:C/-fno-tree-vrp//}
CFLAGS+= -Wno-address-of-packed-member
CFLAGS+= -D_WANT_SEMUN
CONFIGURE_ARGS+= --prefix=${PREFIX} --cc=${CC} --enable-docs \
--disable-linux-user --disable-linux-aio \
--disable-kvm --disable-xen \

View file

@ -0,0 +1,22 @@
--- src/libs/xpcom18a4/nsprpub/pr/src/pthreads/ptsynch.c.orig
+++ src/libs/xpcom18a4/nsprpub/pr/src/pthreads/ptsynch.c
@@ -49,6 +49,9 @@
#include <string.h>
#include <pthread.h>
#include <sys/time.h>
+#ifdef FREEBSD
+#include <sys/param.h>
+#endif
static pthread_mutexattr_t _pt_mattr;
static pthread_condattr_t _pt_cvar_attr;
@@ -798,7 +801,8 @@
* From the semctl(2) man page in glibc 2.0
*/
#if (defined(__GNU_LIBRARY__) && !defined(_SEM_SEMUN_UNDEFINED)) \
- || defined(FREEBSD) || defined(OPENBSD) || defined(BSDI)
+ || (defined(FREEBSD) && __FreeBSD_version < 1200059) \
+ || defined(OPENBSD) || defined(BSDI)
/* union semun is defined by including <sys/sem.h> */
#else
/* according to X/OPEN we have to define it ourselves */

View file

@ -15,6 +15,7 @@ LICENSE= GPLv2
USES= pathfix pkgconfig tar:bzip2 ssl
GNU_CONFIGURE= yes
USE_GNOME= glib20 gtk20
CFLAGS+= -D_WANT_SEMUN
OPTIONS_DEFINE= NLS
OPTIONS_SUB= yes

View file

@ -0,0 +1,20 @@
--- cint/lib/ipc/ipcif.h.orig
+++ cint/lib/ipc/ipcif.h
@@ -28,13 +28,16 @@
#include <sys/ipc.h>
#include <sys/shm.h>
#include <sys/sem.h>
+#ifdef __FreeBSD__
+#include <sys/param.h>
+#endif
#if defined(G__APPLE) || defined(__APPLE__)
/* union semun is defined by including <sys/sem.h> */
#elif defined(__GNU_LIBRARY__) && !defined(_SEM_SEMUN_UNDEFINED)
/* union semun is defined by including <sys/sem.h> */
#else
/* according to X/OPEN we have to define it ourselves */
-#if !defined(__FreeBSD__) && !defined(__KCC) && !defined(__sgi)
+#if (!defined(__FreeBSD__) || __FreeBSD_version >= 1200059) && !defined(__KCC) && !defined(__sgi)
union semun {
int val; /* value for SETVAL */
struct semid_ds *buf; /* buffer for IPC_STAT, IPC_SET */

View file

@ -23,6 +23,7 @@ LDFLAGS+= -lpthread -L${LOCALBASE}/lib
USE_LDCONFIG= yes
PLIST_SUB= MACHINE_ARCH=${MACHINE_ARCH}
INSTALL_TARGET= install-strip
CFLAGS+= -D_WANT_SEMUN
PORTDOCS= *

View file

@ -24,6 +24,7 @@ USE_LDCONFIG= yes
LLD_UNSAFE= yes # lld lacks built-in search paths
MAKEFILE= Makefile.bsd
MAKE_ARGS+= PLIBS="${LDFLAGS:M-L*} -lncurses"
CFLAGS+= -D_WANT_SEMUN
SUB_FILES= regutil.1

View file

@ -18,6 +18,7 @@ USES= uidfix ssl
USE_RC_SUBR= milter-batv
MAKE_ARGS= UBINOWN=${UID} UBINGRP=${GID}
CFLAGS+= -D_WANT_SEMUN
WCONF= ${WRKSRC}/devtools/Site
PLIST_FILES= bin/batv-filter man/man8/batv-filter.8.gz

View file

@ -0,0 +1,14 @@
--- include/sm/os/sm_os_freebsd.h.orig
+++ include/sm/os/sm_os_freebsd.h
@@ -34,7 +34,11 @@
# define SM_CONF_SHM 1
#endif /* SM_CONF_SHM */
#ifndef SM_CONF_SEM
+#if __FreeBSD_version < 1200059
# define SM_CONF_SEM 1
+#else
+# define SM_CONF_SEM 2
+#endif
#endif /* SM_CONF_SEM */
#ifndef SM_CONF_MSG
# define SM_CONF_MSG 1

View file

@ -0,0 +1,14 @@
--- include/sm/os/sm_os_freebsd.h.orig
+++ include/sm/os/sm_os_freebsd.h
@@ -34,7 +34,11 @@
# define SM_CONF_SHM 1
#endif /* SM_CONF_SHM */
#ifndef SM_CONF_SEM
+#if __FreeBSD_version < 1200059
# define SM_CONF_SEM 1
+#else
+# define SM_CONF_SEM 2
+#endif
#endif /* SM_CONF_SEM */
#ifndef SM_CONF_MSG
# define SM_CONF_MSG 1

View file

@ -0,0 +1,14 @@
--- include/sm/os/sm_os_freebsd.h.orig
+++ include/sm/os/sm_os_freebsd.h
@@ -34,7 +34,11 @@
# define SM_CONF_SHM 1
#endif /* SM_CONF_SHM */
#ifndef SM_CONF_SEM
+#if __FreeBSD_version < 1200059
# define SM_CONF_SEM 1
+#else
+# define SM_CONF_SEM 2
+#endif
#endif /* SM_CONF_SEM */
#ifndef SM_CONF_MSG
# define SM_CONF_MSG 1

View file

@ -0,0 +1,14 @@
--- include/sm/os/sm_os_freebsd.h.orig
+++ include/sm/os/sm_os_freebsd.h
@@ -34,7 +34,11 @@
# define SM_CONF_SHM 1
#endif /* SM_CONF_SHM */
#ifndef SM_CONF_SEM
+#if __FreeBSD_version < 1200059
# define SM_CONF_SEM 1
+#else
+# define SM_CONF_SEM 2
+#endif
#endif /* SM_CONF_SEM */
#ifndef SM_CONF_MSG
# define SM_CONF_MSG 1

View file

@ -13,6 +13,7 @@ COMMENT= Buffer sporadic I/O for faster tape and pipe throughput
USES= tar:tgz
PLIST_FILES= bin/buffer \
man/man1/buffer.1.gz
CFLAGS+= -D_WANT_SEMUN
post-patch:
@${REINPLACE_CMD} -E \

View file

@ -18,5 +18,6 @@ RUN_DEPENDS:= ${BUILD_DEPENDS}
USES= python:2.7
USE_GNOME= glib20
USE_PYTHON= distutils autoplist
CFLAGS+= -D_WANT_SEMUN
.include <bsd.port.mk>

View file

@ -15,6 +15,7 @@ LIB_DEPENDS= libnetsnmp.so:net-mgmt/net-snmp
USES= gmake
GNU_CONFIGURE= yes
CFLAGS+= -D_WANT_SEMUN
PLIST_FILES= bin/sdig etc/sdig.conf etc/mactable man/man5/sdig.conf.5.gz \
man/man8/sdig.8.gz

View file

@ -30,6 +30,7 @@ USES= cmake compiler:c++11-lib pkgconfig readline ssl
USE_GITHUB= yes
GH_ACCOUNT= monero-project
GH_PROJECT= monero
CFLAGS+= -D_WANT_SEMUN
OPTIONS_DEFINE= DOXYGEN
DOXYGEN_BUILD_DEPENDS= dot:graphics/graphviz \

View file

@ -36,6 +36,7 @@ CONFIGURE_ENV= PTHREAD_LIBS=-lpthread ac_cv_path_CPP=${CPP}
GNU_CONFIGURE= yes
USE_LDCONFIG= yes
USES= gmake libtool localbase shebangfix
CFLAGS+= -D_WANT_SEMUN
INFO= freeipmi-faq
PLIST_SUB= CACHE_DIR=${CACHE_DIR}

View file

@ -16,6 +16,7 @@ USES= groff perl5 shebangfix
SHEBANG_FILES= client/getsymonitem.pl
USE_PERL5= build
MAKE_JOBS_UNSAFE= yes
CFLAGS+= -D_WANT_SEMUN
USERS= _symon
GROUPS= _symon

View file

@ -0,0 +1,27 @@
--- src/mod_cband.c.orig
+++ src/mod_cband.c
@@ -56,6 +56,9 @@
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/sem.h>
+#ifdef __FreeBSD__
+#include <sys/param.h>
+#endif
#include <unistd.h>
#include "mod_cband.h"
@@ -74,6 +77,14 @@
}
#endif
+#if defined(__FreeBSD__) && __FreeBSD_version >= 1200059
+union semun {
+ int val; /* value for SETVAL */
+ struct semid_ds *buf; /* buffer for IPC_STAT & IPC_SET */
+ u_short *array; /* array for GETALL & SETALL */
+};
+#endif
+
static mod_cband_config_header *config = NULL;
static const char mod_cband_filter_name[] = "CBAND_FILTER";
ap_filter_rec_t *mod_cband_output_filter_handle;