summaryrefslogtreecommitdiff
path: root/devel/libusb/Makefile
blob: 38eec41badddceaecad6d0e40f65bb79da9d3bde (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# $NetBSD: Makefile,v 1.40 2017/08/11 22:17:34 maya Exp $

DISTNAME=	libusb-0.1.12
PKGREVISION=	4
CATEGORIES=	devel
MASTER_SITES=	${MASTER_SITE_SOURCEFORGE:=libusb/}

MAINTAINER=	drochner@NetBSD.org
HOMEPAGE=	http://libusb.sourceforge.net/
COMMENT=	USB access library (version 0)
LICENSE=	gnu-lgpl-v2.1

USE_LANGUAGES=		c c++
USE_LIBTOOL=		yes
GNU_CONFIGURE=		yes
CONFIGURE_ARGS+=	--disable-build-docs
PKGCONFIG_OVERRIDE+=	libusb.pc.in

# The configure script recognizes only specific OSes that have one of
# three USB APIs: Linux, BSD, or MacOS. If you have some other OS that
# supports one of these APIs, add it here and also in the configure
# script. Solaris support has been hacked on separately.
ONLY_FOR_PLATFORM=	Linux-*-*
ONLY_FOR_PLATFORM+=	NetBSD-*-* OpenBSD-*-* FreeBSD-*-*
ONLY_FOR_PLATFORM+=	Darwin-*-*
ONLY_FOR_PLATFORM+=	SunOS-*-*

TEST_TARGET=		check

CONFLICTS=		libusb-compat-[0-9]*

.include "../../mk/bsd.prefs.mk"

.if ${OPSYS} == "SunOS"
CFLAGS+=		-D_REENTRANT -D_TS_ERRNO
CXXFLAGS+=		-Du_int8_t=uint8_t
CXXFLAGS+=		-Du_int16_t=uint16_t
CXXFLAGS+=		-Du_int32_t=uint32_t
SED_TRANSFORMS=		-e 's,@BIGENDIAN@,0,' -e 's,@LINUX_API@,0,'
SED_TRANSFORMS+=	-e 's,u_int8_t,uint8_t,g'
SED_TRANSFORMS+=	-e 's,u_int16_t,uint16_t,g'
SED_TRANSFORMS+=	-e 's,u_int32_t,uint32_t,g'
SED_TRANSFORMS+=	-e "s,@prefix@,${PREFIX},g"
SED_TRANSFORMS+=	-e "s,@exec_prefix@,${PREFIX},g"
SED_TRANSFORMS+=	-e "s,@LIBUSB_VERSION@,${PKGVERSION_NOREV},g"
SED_TRANSFORMS+=	-e "s,@VERSION@,${PKGVERSION_NOREV},g"
SED_TRANSFORMS+=	-e "s,@includedir@,${PREFIX}/include,g"
SED_TRANSFORMS+=	-e "s,@libdir@,${PREFIX}/lib,g"
SED_TRANSFORMS+=	-e "s,@OSLIBS@,,g"

INSTALLATION_DIRS+=	bin include lib/pkgconfig

do-configure:
	cp ${FILESDIR}/libusbugen* ${WRKSRC}/

do-build:
	cd ${WRKSRC} && ${SED} ${SED_TRANSFORMS} usb.h.in >usb.h
	cd ${WRKSRC} && ${SED} ${SED_TRANSFORMS} libusb-config.in >libusb-config
	cd ${WRKSRC} && ${SED} ${SED_TRANSFORMS} libusb.pc.in >libusb.pc
	cd ${WRKSRC} && ${LIBTOOL} --mode=compile --tag=CC ${CC} ${CFLAGS} \
	    -I. -c libusbugen.c
	cd ${WRKSRC} && ${LIBTOOL} --mode=link --tag=CC ${CC} \
	    -rpath ${PREFIX}/lib -version-info 8:4:4 -release 0.1 \
	    -o libusb.la libusbugen.lo
	cd ${WRKSRC} && ${LIBTOOL} --mode=compile --tag=CXX ${CXX} ${CXXFLAGS} \
	    -I. -c usbpp.cpp
	cd ${WRKSRC} && ${LIBTOOL} --mode=link --tag=CXX ${CXX} \
	    -rpath ${PREFIX}/lib -version-info 8:4:4 -release 0.1 \
	    -o libusbpp.la usbpp.lo

do-install:
	${INSTALL_SCRIPT} ${WRKSRC}/libusb-config ${DESTDIR}${PREFIX}/bin
	${INSTALL_DATA} ${WRKSRC}/usb.h ${DESTDIR}${PREFIX}/include
	${INSTALL_DATA} ${WRKSRC}/usbpp.h ${DESTDIR}${PREFIX}/include
	cd ${WRKSRC} && ${LIBTOOL} --mode=install ${INSTALL_LIB} libusb.la \
	    ${DESTDIR}${PREFIX}/lib
	cd ${WRKSRC} && ${LIBTOOL} --mode=install ${INSTALL_LIB} libusbpp.la \
	    ${DESTDIR}${PREFIX}/lib
	${INSTALL_DATA} ${WRKSRC}/libusb.pc ${DESTDIR}${PREFIX}/lib/pkgconfig
.endif

.include "../../mk/bsd.pkg.mk"