Skip to content

Commit

Permalink
Changes to Build System for Haiku
Browse files Browse the repository at this point in the history
Co-authored-by: @CodeforEvolution
Co-authored-by: Luca Weiss <[email protected]>
Co-authored-by: Begasus <[email protected]>
Co-authored-by: Panagiotis Vasilopoulos <[email protected]>
  • Loading branch information
4 people authored and Youw committed Feb 12, 2020
1 parent 533dd92 commit f2611e0
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ if OS_KFREEBSD
SUBDIRS += libusb
endif

if OS_HAIKU
SUBDIRS += libusb
endif

if OS_WINDOWS
SUBDIRS += windows
endif
Expand Down
14 changes: 14 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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])
Expand Down
4 changes: 4 additions & 0 deletions libusb/Makefile-manual
Original file line number Diff line number Diff line change
Expand Up @@ -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.)
Expand Down
7 changes: 7 additions & 0 deletions libusb/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
39 changes: 39 additions & 0 deletions libusb/Makefile.haiku
Original file line number Diff line number Diff line change
@@ -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,[email protected] $^ -o $@ $(LIBS)

# Objects
$(COBJS): %.o: %.c
$(CC) $(CFLAGS) -c $(INCLUDES) $< -o $@


clean:
rm -f $(OBJS) hidtest libhidapi.so ../hidtest/hidtest.o

.PHONY: clean libs

0 comments on commit f2611e0

Please sign in to comment.