Asterisk OpenPSD patch

Asterisk 0.7.1 on OpenBSD 3.4
For use asterisk on OpenBSD i've create a patch, because a lot of compilation error append.

Use 'gmake' not 'make'
Like lot of other linux software you must use gmake (if you don't have it, install it from ports.

The patch

diff ../asterisk-0.7.1/Makefile ./Makefile
--- ../asterisk-0.7.1/Makefile Wed Jan 14 07:48:38 2004
+++ ./Makefile Thu Jan 22 15:49:41 2004
@@ -23,6 +23,10 @@
else
ifeq (${OSARCH},FreeBSD)
PROC=$(shell uname -m)
+else
+ifeq (${OSARCH},OpenBSD)
+PROC=$(shell uname -m)
+endif
endif
endif
# Pentium Pro Optimize
diff ../asterisk-0.7.1/aesopt.h ./aesopt.h
--- ../asterisk-0.7.1/aesopt.h Wed Jan 7 21:45:50 2004
+++ ./aesopt.h Thu Jan 22 14:33:37 2004
@@ -148,7 +148,10 @@

/* PLATFORM SPECIFIC INCLUDES */

-#if defined( __FreeBSD__ ) || defined( __OpenBSD__ )
+#if defined( __OpenBSD__ )
+# include <machine/types.h>
+# include <sys/endian.h>
+#elif defined( __FreeBSD__ )
# include <sys/endian.h>
#elif defined( BSD ) && ( BSD >= 199103 )
# include <machine/endian.h>
diff ../asterisk-0.7.1/channels/Makefile ./channels/Makefile
--- ../asterisk-0.7.1/channels/Makefile Wed Dec 10 03:19:22 2003
+++ ./channels/Makefile Thu Jan 22 14:52:49 2004
@@ -70,6 +70,21 @@
PWLIBDIR=$(HOME)/pwlib
endif

+ifeq (${OSARCH},OpenBSD)
+PTLIB=pt_OpenBSD_x86_r
+H323LIB=h323_OpenBSD_x86_r
+else
+PTLIB=pt_linux_x86_r
+H323LIB=h323_linux_x86_r
+endif
+
+ifeq (${OSARCH},OpenBSD)
+CHANH323LIB=-L/usr/local/lib
+else
+CHANH323LIB=-ldl
+endif
+
+
#CFLAGS+=$(shell [ -f $(ZAPDIR)/libzap.a ] && echo "-I$(ZAPDIR)")

all: depend $(CHANNEL_LIBS)
@@ -140,7 +155,7 @@
$(CXX) $(SOLINK) -o $@ $< -lvpb -lpthread -lm -ldl

chan_h323.so: chan_h323.o h323/libchanh323.a
- $(CC) $(SOLINK) -o $@ $< h323/libchanh323.a -L$(PWLIBDIR)/lib -lpt_linux_x86_r -L$(OPENH323DIR)/lib -lh323_linux_x86_r -L/usr/lib -lpthread -ldl -lcrypto -lssl -lexpat
+ $(CC) $(SOLINK) -o $@ $< h323/libchanh323.a -L$(PWLIBDIR)/lib -l$(PTLIB) -L$(OPENH323DIR)/lib -l$(H323LIB) -L/usr/lib $(CHANH323LIB) -lpthread -lcrypto -lssl -lexpat


#chan_modem.so : chan_modem.o
diff ../asterisk-0.7.1/channels/chan_h323.c ./channels/chan_h323.c
--- ../asterisk-0.7.1/channels/chan_h323.c Tue Jan 13 10:24:26 2004
+++ ./channels/chan_h323.c Thu Jan 22 14:28:32 2004
@@ -26,6 +26,11 @@
* Version Info: $Id: chan_h323.c,v 1.31 2004/01/13 09:24:26 jeremy Exp $
*/

+#ifdef __OpenBSD__
+#ifndef IPTOS_MINCOST
+#define IPTOS_MINCOST 0x02
+#endif
+#endif

#include <stdio.h>
#include <pthread.h>
@@ -54,6 +59,9 @@
#include <fcntl.h>
#include <netdb.h>
#include <sys/signal.h>
+#ifdef __OpenBSD__
+#include <netinet/in_systm.h>
+#endif
#include <netinet/ip.h>


diff ../asterisk-0.7.1/channels/h323/Makefile ./channels/h323/Makefile
--- ../asterisk-0.7.1/channels/h323/Makefile Sun Jan 11 03:22:32 2004
+++ ./channels/h323/Makefile Thu Jan 22 15:09:44 2004
@@ -1,4 +1,5 @@
# include the Makefile of OpenH323
+OSARCH=$(shell uname -s)

ifndef OPENH323DIR
OPENH323DIR=$(HOME)/openh323
@@ -28,7 +29,12 @@
#
CFLAGS += -DNDEBUG -DDO_CRASH -DDEBUG_THREADS
CFLAGS += -pipe -Wall -fPIC -Wmissing-prototypes -Wmissing-declarations
-CFLAGS += -DP_LINUX -D_REENTRANT -D_GNU_SOURCE
+ifeq (${OSARCH},OpenBSD)
+CFLAGS += -DP_OPENBSD=200311
+else
+CFLAGS += -DP_LINUX
+endif
+CFLAGS += -D_REENTRANT -D_GNU_SOURCE
CFLAGS += -DP_HAS_SEMAPHORES -DP_SSL -DP_PTHREADS
CFLAGS += -DPHAS_TEMPLATES -DPTRACING -DP_USE_PRAGMA
CFLAGS += -I../../include
diff ../asterisk-0.7.1/include/asterisk/frame.h ./include/asterisk/frame.h
--- ../asterisk-0.7.1/include/asterisk/frame.h Tue Nov 4 03:40:09 2003
+++ ./include/asterisk/frame.h Thu Jan 22 14:57:32 2004
@@ -27,6 +27,9 @@
#ifdef __linux__
#include <endian.h>
#elif defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__APPLE__)
+#if defined(__OpenBSD__)
+#include <machine/types.h>
+#endif
#include <machine/endian.h>
#define __BYTE_ORDER BYTE_ORDER
#define __LITTLE_ENDIAN LITTLE_ENDIAN

See also

Asterisk 0.7.1 on OpenBSD 3.4
For use asterisk on OpenBSD i've create a patch, because a lot of compilation error append.

Use 'gmake' not 'make'
Like lot of other linux software you must use gmake (if you don't have it, install it from ports.

The patch

diff ../asterisk-0.7.1/Makefile ./Makefile
--- ../asterisk-0.7.1/Makefile Wed Jan 14 07:48:38 2004
+++ ./Makefile Thu Jan 22 15:49:41 2004
@@ -23,6 +23,10 @@
else
ifeq (${OSARCH},FreeBSD)
PROC=$(shell uname -m)
+else
+ifeq (${OSARCH},OpenBSD)
+PROC=$(shell uname -m)
+endif
endif
endif
# Pentium Pro Optimize
diff ../asterisk-0.7.1/aesopt.h ./aesopt.h
--- ../asterisk-0.7.1/aesopt.h Wed Jan 7 21:45:50 2004
+++ ./aesopt.h Thu Jan 22 14:33:37 2004
@@ -148,7 +148,10 @@

/* PLATFORM SPECIFIC INCLUDES */

-#if defined( __FreeBSD__ ) || defined( __OpenBSD__ )
+#if defined( __OpenBSD__ )
+# include <machine/types.h>
+# include <sys/endian.h>
+#elif defined( __FreeBSD__ )
# include <sys/endian.h>
#elif defined( BSD ) && ( BSD >= 199103 )
# include <machine/endian.h>
diff ../asterisk-0.7.1/channels/Makefile ./channels/Makefile
--- ../asterisk-0.7.1/channels/Makefile Wed Dec 10 03:19:22 2003
+++ ./channels/Makefile Thu Jan 22 14:52:49 2004
@@ -70,6 +70,21 @@
PWLIBDIR=$(HOME)/pwlib
endif

+ifeq (${OSARCH},OpenBSD)
+PTLIB=pt_OpenBSD_x86_r
+H323LIB=h323_OpenBSD_x86_r
+else
+PTLIB=pt_linux_x86_r
+H323LIB=h323_linux_x86_r
+endif
+
+ifeq (${OSARCH},OpenBSD)
+CHANH323LIB=-L/usr/local/lib
+else
+CHANH323LIB=-ldl
+endif
+
+
#CFLAGS+=$(shell [ -f $(ZAPDIR)/libzap.a ] && echo "-I$(ZAPDIR)")

all: depend $(CHANNEL_LIBS)
@@ -140,7 +155,7 @@
$(CXX) $(SOLINK) -o $@ $< -lvpb -lpthread -lm -ldl

chan_h323.so: chan_h323.o h323/libchanh323.a
- $(CC) $(SOLINK) -o $@ $< h323/libchanh323.a -L$(PWLIBDIR)/lib -lpt_linux_x86_r -L$(OPENH323DIR)/lib -lh323_linux_x86_r -L/usr/lib -lpthread -ldl -lcrypto -lssl -lexpat
+ $(CC) $(SOLINK) -o $@ $< h323/libchanh323.a -L$(PWLIBDIR)/lib -l$(PTLIB) -L$(OPENH323DIR)/lib -l$(H323LIB) -L/usr/lib $(CHANH323LIB) -lpthread -lcrypto -lssl -lexpat


#chan_modem.so : chan_modem.o
diff ../asterisk-0.7.1/channels/chan_h323.c ./channels/chan_h323.c
--- ../asterisk-0.7.1/channels/chan_h323.c Tue Jan 13 10:24:26 2004
+++ ./channels/chan_h323.c Thu Jan 22 14:28:32 2004
@@ -26,6 +26,11 @@
* Version Info: $Id: chan_h323.c,v 1.31 2004/01/13 09:24:26 jeremy Exp $
*/

+#ifdef __OpenBSD__
+#ifndef IPTOS_MINCOST
+#define IPTOS_MINCOST 0x02
+#endif
+#endif

#include <stdio.h>
#include <pthread.h>
@@ -54,6 +59,9 @@
#include <fcntl.h>
#include <netdb.h>
#include <sys/signal.h>
+#ifdef __OpenBSD__
+#include <netinet/in_systm.h>
+#endif
#include <netinet/ip.h>


diff ../asterisk-0.7.1/channels/h323/Makefile ./channels/h323/Makefile
--- ../asterisk-0.7.1/channels/h323/Makefile Sun Jan 11 03:22:32 2004
+++ ./channels/h323/Makefile Thu Jan 22 15:09:44 2004
@@ -1,4 +1,5 @@
# include the Makefile of OpenH323
+OSARCH=$(shell uname -s)

ifndef OPENH323DIR
OPENH323DIR=$(HOME)/openh323
@@ -28,7 +29,12 @@
#
CFLAGS += -DNDEBUG -DDO_CRASH -DDEBUG_THREADS
CFLAGS += -pipe -Wall -fPIC -Wmissing-prototypes -Wmissing-declarations
-CFLAGS += -DP_LINUX -D_REENTRANT -D_GNU_SOURCE
+ifeq (${OSARCH},OpenBSD)
+CFLAGS += -DP_OPENBSD=200311
+else
+CFLAGS += -DP_LINUX
+endif
+CFLAGS += -D_REENTRANT -D_GNU_SOURCE
CFLAGS += -DP_HAS_SEMAPHORES -DP_SSL -DP_PTHREADS
CFLAGS += -DPHAS_TEMPLATES -DPTRACING -DP_USE_PRAGMA
CFLAGS += -I../../include
diff ../asterisk-0.7.1/include/asterisk/frame.h ./include/asterisk/frame.h
--- ../asterisk-0.7.1/include/asterisk/frame.h Tue Nov 4 03:40:09 2003
+++ ./include/asterisk/frame.h Thu Jan 22 14:57:32 2004
@@ -27,6 +27,9 @@
#ifdef __linux__
#include <endian.h>
#elif defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__APPLE__)
+#if defined(__OpenBSD__)
+#include <machine/types.h>
+#endif
#include <machine/endian.h>
#define __BYTE_ORDER BYTE_ORDER
#define __LITTLE_ENDIAN LITTLE_ENDIAN

See also

Created by: oej, Last modification: Sat 24 of Jan, 2004 (09:33 UTC)
Please update this page with new information, just login and click on the "Edit" or "Discussion" tab. Get a free login here: Register Thanks! - Find us on Google+