1################################################################################
2#
3# sg3_utils
4#
5################################################################################
6
7SG3_UTILS_VERSION = 1.48
8SG3_UTILS_SOURCE = sg3_utils-$(SG3_UTILS_VERSION).tar.xz
9SG3_UTILS_SITE = http://sg.danny.cz/sg/p
10SG3_UTILS_LICENSE = BSD-2-Clause (library)
11# Some utils progs are GPL-2.0+ licensed while others are BSD-3-Clause
12ifeq ($(BR2_PACKAGE_SG3_UTILS_PROGS),y)
13SG3_UTILS_LICENSE += , GPL-2.0+ (programs), BSD-2-Clause (programs)
14endif
15SG3_UTILS_LICENSE_FILES = COPYING BSD_LICENSE
16
17# install the libsgutils2 library
18SG3_UTILS_INSTALL_STAGING = YES
19
20# Uses __atomic_fetch_add_4
21ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y)
22SG3_UTILS_CONF_ENV += LIBS="-latomic"
23endif
24
25SG3_UTILS_CFLAGS = $(TARGET_CFLAGS)
26
27ifeq ($(BR2_TOOLCHAIN_HAS_GCC_BUG_104028),y)
28SG3_UTILS_CFLAGS += -O0
29endif
30
31SG3_UTILS_CONF_ENV += CFLAGS="$(SG3_UTILS_CFLAGS)"
32
33ifeq ($(BR2_PACKAGE_SG3_UTILS_PROGS),)
34define SG3_UTILS_REMOVE_PROGS
35	for prog in \
36		compare_and_write copy_results dd decode_sense \
37		emc_trespass format get_config \
38		get_lba_status ident inq logs luns map26 \
39		map sgm_dd modes opcodes sgp_dd persist prevent \
40		raw rbuf rdac read readcap read_block_limits \
41		read_attr read_buffer read_long reassign referrals \
42		rep_zones requests reset reset_wp rmsn rtpg safte sanitize \
43		sat_identify sat_phy_event sat_read_gplog sat_set_features \
44		scan senddiag ses ses_microcode start stpg sync test_rwbuf \
45		timestamp turs unmap verify vpd write_buffer write_long \
46		write_same write_verify wr_mode xcopy zone; do \
47		$(RM) $(TARGET_DIR)/usr/bin/sg_$${prog} ; \
48	done
49	for prog in \
50		logging_level mandat readcap ready satl start stop \
51		temperature; do \
52		$(RM) $(TARGET_DIR)/usr/bin/scsi_$${prog} ; \
53	done
54	for prog in \
55		sginfo sgm_dd sgp_dd; do \
56		$(RM) $(TARGET_DIR)/usr/bin/$${prog}; \
57	done
58endef
59
60SG3_UTILS_POST_INSTALL_TARGET_HOOKS += SG3_UTILS_REMOVE_PROGS
61endif
62
63$(eval $(autotools-package))
64$(eval $(host-autotools-package))
65