shithub: openh264

Download patch

ref: 8994f1f757d985629c796a565e3a6ffb575adeaa
parent: 047406850370f98a9f364a13a115dfa93ada64da
parent: f383137fe1f92a9076d732f03ed628b5b087889d
author: HaiboZhu <haibozhu@cisco.com>
date: Wed Sep 16 05:07:08 EDT 2015

Merge pull request #2115 from fstd/support_netbsd_2

Support NetBSD and OpenBSD; consolidate BSD build.

--- a/Makefile
+++ b/Makefile
@@ -7,7 +7,7 @@
 vpath %.rc $(SRC_PATH)
 vpath %.pc.in $(SRC_PATH)
 
-OS=$(shell uname | tr A-Z a-z | tr -d \\-[:digit:].)
+OS=$(shell uname | tr A-Z a-z | tr -d \\-[:digit:]. | sed -E 's/^(net|open|free)bsd/bsd/')
 ARCH=$(shell uname -m)
 LIBPREFIX=lib
 LIBSUFFIX=a
--- /dev/null
+++ b/build/platform-bsd.mk
@@ -1,0 +1,14 @@
+include $(SRC_PATH)build/arch.mk
+SHAREDLIBSUFFIX = so
+SHAREDLIBSUFFIXVER=$(SHAREDLIBSUFFIX).$(SHAREDLIBVERSION)
+SHLDFLAGS = -Wl,-soname,$(LIBPREFIX)$(PROJECT_NAME).$(SHAREDLIBSUFFIXVER)
+CFLAGS += -fPIC
+LDFLAGS += -lpthread
+ifeq ($(ASM_ARCH), x86)
+ifeq ($(ARCH), x86_64)
+ASMFLAGS += -f elf64
+else
+ASMFLAGS += -f elf
+endif
+endif
+
--- a/build/platform-freebsd.mk
+++ /dev/null
@@ -1,14 +1,0 @@
-include $(SRC_PATH)build/arch.mk
-SHAREDLIBSUFFIX = so
-SHAREDLIBSUFFIXVER=$(SHAREDLIBSUFFIX).$(SHAREDLIBVERSION)
-SHLDFLAGS = -Wl,-soname,$(LIBPREFIX)$(PROJECT_NAME).$(SHAREDLIBSUFFIXVER)
-CFLAGS += -fPIC
-LDFLAGS += -lpthread
-ifeq ($(ASM_ARCH), x86)
-ifeq ($(ARCH), x86_64)
-ASMFLAGS += -f elf64
-else
-ASMFLAGS += -f elf
-endif
-endif
-
--- a/codec/common/src/WelsThreadLib.cpp
+++ b/codec/common/src/WelsThreadLib.cpp
@@ -504,7 +504,12 @@
 
   size_t len = sizeof (pInfo->ProcessorCount);
 
+#if defined(__OpenBSD__)
+  int scname[] = { CTL_HW, HW_NCPU };
+  if (sysctl (scname, 2, &pInfo->ProcessorCount, &len, NULL, 0) == -1)
+#else
   if (sysctlbyname (HW_NCPU_NAME, &pInfo->ProcessorCount, &len, NULL, 0) == -1)
+#endif
     pInfo->ProcessorCount = 1;
 
   return WELS_THREAD_ERROR_OK;