Skip to content

Commit

Permalink
build: libhb: cli: Improve support for NetBSD.
Browse files Browse the repository at this point in the history
  • Loading branch information
bradleysepos committed Feb 10, 2020
1 parent 24914e5 commit fc86181
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 12 deletions.
2 changes: 1 addition & 1 deletion libhb/fifo.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#endif

#ifndef SYS_DARWIN
#if defined( SYS_FREEBSD ) || defined ( __FreeBSD__ )
#if defined( SYS_FREEBSD ) || defined ( __FreeBSD__ ) || defined(SYS_NETBSD)
#include <stdlib.h>
#else
#include <malloc.h>
Expand Down
2 changes: 2 additions & 0 deletions libhb/module.defs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ else ifeq ($(HOST.system),linux)
LIBHB.GCC.D += SYS_LINUX _LARGEFILE_SOURCE _FILE_OFFSET_BITS=64
else ifeq ($(HOST.system),freebsd)
LIBHB.GCC.D += SYS_FREEBSD _LARGEFILE_SOURCE _FILE_OFFSET_BITS=64
else ifeq ($(HOST.system),netbsd)
LIBHB.GCC.D += SYS_NETBSD _LARGEFILE_SOURCE _FILE_OFFSET_BITS=64
else ifeq ($(HOST.system),mingw)
LIBHB.GCC.D += SYS_MINGW
ifneq ($(HAS.pthread),1)
Expand Down
12 changes: 6 additions & 6 deletions libhb/ports.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#include <kernel/OS.h>
#endif

#if defined(SYS_DARWIN) || defined(SYS_FREEBSD)
#if defined(SYS_DARWIN) || defined(SYS_FREEBSD) || defined(SYS_NETBSD)
#include <sys/types.h>
#include <sys/sysctl.h>
#if HB_PROJECT_FEATURE_QSV && defined(SYS_FREEBSD)
Expand Down Expand Up @@ -222,7 +222,7 @@ void hb_snooze( int delay )
}
#if defined( SYS_BEOS )
snooze( 1000 * delay );
#elif defined( SYS_DARWIN ) || defined( SYS_LINUX ) || defined( SYS_FREEBSD) || defined( SYS_SunOS )
#elif defined( SYS_DARWIN ) || defined( SYS_LINUX ) || defined( SYS_FREEBSD) || defined(SYS_NETBSD) || defined( SYS_SunOS )
usleep( 1000 * delay );
#elif defined( SYS_CYGWIN ) || defined( SYS_MINGW )
Sleep( delay );
Expand Down Expand Up @@ -447,9 +447,9 @@ static int init_cpu_count()
get_system_info( &info );
cpu_count = info.cpu_count;

#elif defined(SYS_DARWIN) || defined(SYS_FREEBSD) || defined(SYS_OPENBSD)
#elif defined(SYS_DARWIN) || defined(SYS_FREEBSD) || defined(SYS_NETBSD) || defined(SYS_OPENBSD)
size_t length = sizeof( cpu_count );
#ifdef SYS_OPENBSD
#ifdef SYS_OPENBSD || defined(SYS_NETBSD)
int mib[2] = { CTL_HW, HW_NCPU };
if( sysctl(mib, 2, &cpu_count, &length, NULL, 0) )
#else
Expand Down Expand Up @@ -862,7 +862,7 @@ static void attribute_align_thread hb_thread_func( void * _t )
{
hb_thread_t * t = (hb_thread_t *) _t;

#if defined( SYS_DARWIN ) || defined( SYS_FREEBSD ) || defined ( __FreeBSD__ )
#if defined( SYS_DARWIN ) || defined( SYS_FREEBSD ) || defined ( __FreeBSD__ ) || defined(SYS_NETBSD)
/* Set the thread priority */
struct sched_param param;
memset( &param, 0, sizeof( struct sched_param ) );
Expand Down Expand Up @@ -1009,7 +1009,7 @@ hb_lock_t * hb_lock_init()

pthread_mutexattr_init(&mta);

#if defined( SYS_CYGWIN ) || defined( SYS_FREEBSD ) || defined ( __FreeBSD__ )
#if defined( SYS_CYGWIN ) || defined( SYS_FREEBSD ) || defined ( __FreeBSD__ ) || defined(SYS_NETBSD)
pthread_mutexattr_settype(&mta, PTHREAD_MUTEX_NORMAL);
#endif

Expand Down
8 changes: 4 additions & 4 deletions make/configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -1378,10 +1378,10 @@ def createCLI( cross = None ):
h = IfHost( 'enable assembly code in non-contrib modules', 'NOMATCH*-*-darwin*', 'NOMATCH*-*-linux*', none=argparse.SUPPRESS ).value
grp.add_argument( '--enable-asm', default=False, action='store_true', help=h )

h = IfHost( 'disable GTK GUI', '*-*-linux*', '*-*-freebsd*', none=argparse.SUPPRESS ).value
h = IfHost( 'disable GTK GUI', '*-*-linux*', '*-*-freebsd*', '*-*-netbsd*', none=argparse.SUPPRESS ).value
grp.add_argument( '--disable-gtk', default=False, action='store_true', help=h )

h = IfHost( 'disable GTK GUI update checks', '*-*-linux*', '*-*-freebsd*', none=argparse.SUPPRESS ).value
h = IfHost( 'disable GTK GUI update checks', '*-*-linux*', '*-*-freebsd*', '*-*-netbsd*', none=argparse.SUPPRESS ).value
grp.add_argument( '--disable-gtk-update-checks', default=False, action='store_true', help=h )

h = 'enable GTK GUI for Windows' if (cross is not None and 'mingw' in cross) else argparse.SUPPRESS
Expand All @@ -1390,7 +1390,7 @@ def createCLI( cross = None ):
h = IfHost( 'Build GUI with GTK4', '*-*-linux*', '*-*-freebsd*', none=argparse.SUPPRESS ).value
grp.add_argument( '--enable-gtk4', default=False, action='store_true', help=h )

h = IfHost( 'disable GStreamer (live preview)', '*-*-linux*', '*-*-freebsd*', none=argparse.SUPPRESS ).value
h = IfHost( 'disable GStreamer (live preview)', '*-*-linux*', '*-*-freebsd*', '*-*-netbsd*', none=argparse.SUPPRESS ).value
grp.add_argument( '--disable-gst', default=False, action='store_true', help=h )

h = IfHost( 'x265 video encoder', '*-*-*', none=argparse.SUPPRESS ).value
Expand Down Expand Up @@ -2042,7 +2042,7 @@ class Tools:

else:
doc.addBlank()
if host_tuple.system == 'freebsd':
if host_tuple.system in ('freebsd', 'netbsd'):
doc.add( 'HAS.pthread', 1 )
if not strerror_r.fail:
doc.add( 'HAS.strerror_r', 1 )
Expand Down
2 changes: 1 addition & 1 deletion test/module.defs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ ifeq (1, $(FEATURE.numa))
endif
else ifeq ($(HOST.system),kfreebsd)
TEST.GCC.l += pthread dl m
else ifeq ($(HOST.system),freebsd)
else ifneq (,$(filter $(HOST.system),freebsd netbsd))
TEST.GCC.L += $(LOCALBASE)/lib
TEST.GCC.l += pthread m
else ifeq ($(HOST.system),solaris)
Expand Down

0 comments on commit fc86181

Please sign in to comment.