summaryrefslogtreecommitdiff
path: root/ham/uhd/Makefile
blob: 64f1e8c164c02b26fb6a57d41049661c03665421 (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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
# $NetBSD: Makefile,v 1.3 2014/09/08 10:02:02 obache Exp $

DISTNAME=		uhd-release_003_007_002
PKGNAME=		uhd-3.7.2
CATEGORIES=		ham
MASTER_SITES=		-https://github.com/EttusResearch/uhd/archive/${DISTNAME:S/uhd-//}${EXTRACT_SUFX}
EXTRACT_SUFX=		.zip

MAINTAINER=		pkgsrc-users@NetBSD.org
HOMEPAGE=		http://code.ettus.com/redmine/ettus/projects/uhd/wiki
COMMENT=		USRP (Universal Software Radio Peripheral) Hardware Drivers
LICENSE=		gnu-gpl-v2

BUILD_DEPENDS+=		${PYPKGPREFIX}-cheetah-[0-9]*:../../devel/py-cheetah
USE_LANGUAGES=		c c++
USE_TOOLS=		cmake pkg-config

# Please note distribution has many stuff under uhd/, but build itself
# needs under host/ only.  Those uhd/ stuff will be handled post-{patch,install}:
WRKSRC=			${WRKDIR}/${DISTNAME}/host

# The files with their name uhd-xxxx, are moved down from uhd/xxxx for this process.
REPLACE_PYTHON=	\
	utils/uhd_images_downloader.py.in \
	utils/usrp2_card_burner.py \
	utils/usrp2_card_burner_gui.py \
	utils/usrp_n2xx_net_burner.py \
	utils/usrp_n2xx_net_burner_gui.py \
	uhd-firmware/fx2/utils/build_eeprom.py \
	uhd-firmware/fx2/utils/edit-gpif-b100.py \
	uhd-firmware/fx2/utils/edit-gpif.py \
	uhd-firmware/fx2/utils/generate_regs.py \
        uhd-firmware/x300/bin_to_coe.py \
	uhd-firmware/zpu/bin/bin_to_mif.py \
	uhd-firmware/zpu/bin/bin_to_ram_macro_init.py \
	uhd-firmware/zpu/bin/divisors.py \
	uhd-firmware/zpu/bin/elf_to_sbf \
	uhd-firmware/zpu/bin/serial_loader \
	uhd-firmware/zpu/bin/uart_ihex_flash_loader.py \
	uhd-firmware/zpu/bin/uart_ihex_ram_loader.py \
	uhd-fpga/usrp1/gen_makefile_extra.py \
	uhd-fpga/usrp1/sdr_lib/gen_cordic_consts.py \
	uhd-fpga/usrp1/tb/makesine.pl \
	uhd-fpga/usrp1/toplevel/mrfm/mrfm.py \
	uhd-fpga/usrp1/toplevel/mrfm/mrfm_fft.py \
	uhd-fpga/usrp2/sdr_lib/gen_cordic_consts.py \
	uhd-fpga/usrp2/top/extract_usage.py \
	uhd-fpga/usrp2/top/python/check_inout.py \
	uhd-fpga/usrp2/top/python/check_timing.py \
	uhd-fpga/usrp3/top/python/bit_to_zynq_bin.py \
	uhd-fpga/usrp3/top/python/check_inout.py \
	uhd-fpga/usrp3/top/python/check_timing.py \
        uhd-fpga/usrp3/lib/io_port2/create-lvbitx.py \

REPLACE_PERL=	uhd-fpga/usrp1/tb/makesine.pl

REPLACE_BASH=	\
	uhd-fpga/usrp2/top/impactor.sh \
	uhd-fpga/usrp3/top/impactor.sh \
        uhd-fpga/usrp3/top/python/batch-build \

INSTALLATION_DIRS+=	share/uhd
INSTALLATION_DIRS+=	share/uhd/firmware
INSTALLATION_DIRS+=	share/uhd/fpga
INSTALLATION_DIRS+=	share/uhd/images

SUBST_CLASSES+=		man
SUBST_MESSAGE.man=	Convert share/man to man
SUBST_STAGE.man=	pre-configure
SUBST_FILES.man=	docs/CMakeLists.txt
SUBST_SED.man=		-e '/UHD_INSTALL/s,$${PKG_MAN_DIR},${PREFIX}/${PKGMANDIR}/man1,'
# UHD_INSTALL(FILES ${gzfile} DESTINATION ${PKG_MAN_DIR} COMPONENT manpages)

# is it default ? and redundent ?
PLIST_SRC=	${PKGDIR}/PLIST
.include "options.mk"

# Copy (beyond) upper directory files (which should be handled at post-install)
# to receive REPLACE_PYTHON conversion ( otherwise above the range )
post-patch:
	(cd ${WRKDIR}; \
	for i in firmware fpga images ; do \
	  ${MKDIR} ${WRKSRC}/uhd-$$i ;\
	${CP} -r ${WRKDIR}/${DISTNAME}/$$i/* ${WRKSRC}/uhd-$$i ;\
	done)

do-configure:
	(cd $(WRKSRC) ; \
	cmake \
	-DCMAKE_BUILD_WITH_INSTALL_RPATH=True \
	-DCMAKE_INSTALL_PREFIX=${PREFIX} \
	-DCMAKE_INSTALL_RPATH=${PREFIX}/lib \
	-DCMAKE_INSTALL_RPATH_USE_LINK_PATH=FALSE \
	-DLIBUSB_INCLUDE_DIR=${PREFIX}/include/libusb-1.0 \
	-DENABLE_LIBUHD=True \
	-DENABLE_EXAMPLES=True \
	-DENABLE_UTILS=True \
	-DENABLE_TESTS=True \
	-DENABLE_MANUAL=True \
	-DENABLE_DOXYGEN=True \
	-DENABLE_MAN_PAGES=True \
	-DENABLE_ORC=True \
	-DENABLE_USB=True \
	-DENABLE_USRP1=True \
	-DENABLE_USRP2=True \
	-DENABLE_B100=True \
	-DENABLE_X300=True \
	-DENABLE_B200=True \
	-DENABLE_E100=True \
	.)
# E100 above is Linux only

# (1) move back the files to original location after REPLACE_PYTHON handled
# (2) suppress warning at intallation, "non executable files get +x bit set".
#
#  Converting ${CP} into ${INTALL_DATA_DIR} and ${INSTALL_DATA} as pkglint
#  flags are not easy, sorry for that.
post-install:
	for i in firmware fpga images ; do \
	  ${CP} -r ${WRKSRC}/uhd-$$i/* ${DESTDIR}${PREFIX}/share/uhd/$$i/;\
	  ${FIND} ${DESTDIR}${PREFIX}/share/uhd/$$i -type f -exec \
	          ${CHMOD} -x '{}' \; ;\
		done	

.include "../../lang/python/application.mk"
.include "../../devel/boost-libs/buildlink3.mk"
.include "../../devel/libusb1/buildlink3.mk"
.include "../../devel/orc/buildlink3.mk"

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