Changes to Build System for Haiku

Co-authored-by: @CodeforEvolution
Co-authored-by: Luca Weiss <luca@z3ntu.xyz>
Co-authored-by: Begasus <begasus@gmail.com>
Co-authored-by: Panagiotis Vasilopoulos <hello@alwayslivid.com>
This commit is contained in:
CodeforEvolution 2020-01-29 21:16:07 +02:00 committed by Ihor Dutchak
parent 533dd9229a
commit f2611e0237
5 changed files with 68 additions and 0 deletions

View File

@ -31,6 +31,10 @@ if OS_KFREEBSD
SUBDIRS += libusb
endif
if OS_HAIKU
SUBDIRS += libusb
endif
if OS_WINDOWS
SUBDIRS += windows
endif

View File

@ -109,6 +109,19 @@ case $host in
LIBS_LIBUSB_PRIVATE="${LIBS_LIBUSB_PRIVATE} $libusb_LIBS"
CFLAGS_LIBUSB="${CFLAGS_LIBUSB} $libusb_CFLAGS"
;;
*-*-haiku)
AC_MSG_RESULT([ (Haiku back-end)])
AC_DEFINE(OS_HAIKU, 1, [Haiku implementation])
AC_SUBST(OS_HAIKU)
backend="libusb"
os="haiku"
threads="pthreads"
PKG_CHECK_MODULES([libusb], [libusb-1.0 >= 1.0.9], true, [hidapi_lib_error libusb-1.0])
LIBS_LIBUSB_PRIVATE="${LIBS_LIBUSB_PRIVATE} $libusb_LIBS"
CFLAGS_LIBUSB="${CFLAGS_LIBUSB} $libusb_CFLAGS"
AC_CHECK_LIB([iconv], [libiconv_open], [LIBS_LIBUSB_PRIVATE="${LIBS_LIBUSB_PRIVATE} -liconv"], [hidapi_lib_error libiconv])
;;
*-mingw*)
AC_MSG_RESULT([ (Windows back-end, using MinGW)])
backend="windows"
@ -215,6 +228,7 @@ AM_CONDITIONAL(OS_LINUX, test "x$os" = xlinux)
AM_CONDITIONAL(OS_DARWIN, test "x$os" = xdarwin)
AM_CONDITIONAL(OS_FREEBSD, test "x$os" = xfreebsd)
AM_CONDITIONAL(OS_KFREEBSD, test "x$os" = xkfreebsd)
AM_CONDITIONAL(OS_HAIKU, test "x$os" = xhaiku)
AM_CONDITIONAL(OS_WINDOWS, test "x$os" = xwindows)
AC_CONFIG_HEADERS([config.h])

View File

@ -10,6 +10,10 @@ ifeq ($(OS), FreeBSD)
FILE=Makefile.freebsd
endif
ifeq ($(OS), Haiku)
FILE=Makefile.haiku
endif
ifeq ($(FILE), )
all:
$(error Your platform ${OS} is not supported by hidapi/libusb at this time.)

View File

@ -21,6 +21,13 @@ libhidapi_la_LDFLAGS = $(LTLDFLAGS)
libhidapi_la_LIBADD = $(LIBS_LIBUSB)
endif
if OS_HAIKU
lib_LTLIBRARIES = libhidapi.la
libhidapi_la_SOURCES = hid.c
libhidapi_la_LDFLAGS = $(LTLDFLAGS)
libhidapi_la_LIBADD = $(LIBS_LIBUSB)
endif
hdrdir = $(includedir)/hidapi
hdr_HEADERS = $(top_srcdir)/hidapi/hidapi.h

39
libusb/Makefile.haiku Normal file
View File

@ -0,0 +1,39 @@
###########################################
# Simple Makefile for HIDAPI test program
#
# Alan Ott
# Signal 11 Software
# 2010-06-01
###########################################
all: hidtest libs
libs: libhidapi.so
CC ?= cc
CFLAGS ?= -Wall -g -fPIC
COBJS = hid.o ../hidtest/test.o
OBJS = $(COBJS)
INCLUDES = -I../hidapi -I/usr/local/include
LDFLAGS = -L/usr/local/lib
LIBS = -lusb -liconv -pthread
# Console Test Program
hidtest: $(OBJS)
$(CC) $(CFLAGS) $(LDFLAGS) $^ -o $@ $(LIBS)
# Shared Libs
libhidapi.so: $(COBJS)
$(CC) $(LDFLAGS) -shared -Wl,-soname,$@.0 $^ -o $@ $(LIBS)
# Objects
$(COBJS): %.o: %.c
$(CC) $(CFLAGS) -c $(INCLUDES) $< -o $@
clean:
rm -f $(OBJS) hidtest libhidapi.so ../hidtest/hidtest.o
.PHONY: clean libs