aboutsummaryrefslogtreecommitdiff
path: root/utils/hwinfo/Makefile
blob: 1edfaea6c5e2687187187adb0a1523f10ec05e44 (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
include $(TOPDIR)/rules.mk

PKG_NAME:=hwinfo
PKG_VERSION:=21.71
PKG_RELEASE:=4

PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/openSUSE/hwinfo/tar.gz/$(PKG_VERSION)?
PKG_HASH:=c4c573eb15cbc10103f5044b485d7e4ff941500ed559743a1c98e6a6deb0ebda

PKG_LICENSE:=GPL-2.0-or-later
PKG_LICENSE_FILES:=COPYING
PKG_MAINTAINER:=Alberto Bursi <bobafetthotmail@gmail.com>

PKG_BUILD_DEPENDS:= hwinfo/host

include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/host-build.mk

define Host/Configure
	# copy uuid.h to another location in host build dir as that's where this package expects it
	$(INSTALL_DIR) $(STAGING_DIR_HOST)/include/uuid/
	$(CP) $(STAGING_DIR_HOST)/include/e2fsprogs/uuid/uuid.h $(STAGING_DIR_HOST)/include/uuid/uuid.h
endef

define Host/Compile
	# Build using host compiler and let it generate the files we need
	# CFLAGS, CPPFLAGS & LDFLAGS need to be passed with CC because they are being ingored
	CC="$(HOSTCC) $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(HOST_LDFLAGS)" $(MAKE) \
		-C $(HOST_BUILD_DIR)/src/isdn/cdb
	CC="$(HOSTCC) $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(HOST_LDFLAGS)" $(MAKE) \
		-C $(HOST_BUILD_DIR)/src/ids
endef

define Host/Install
	$(INSTALL_DIR) $(STAGING_DIR_HOST)/share/hwinfo
	$(CP) $(HOST_BUILD_DIR)/src/isdn/cdb/isdn_cdb $(STAGING_DIR_HOST)/share/hwinfo/
	$(CP) $(HOST_BUILD_DIR)/src/isdn/cdb/mk_isdnhwdb $(STAGING_DIR_HOST)/share/hwinfo/
		
	$(CP) $(HOST_BUILD_DIR)/src/ids/check_hd $(STAGING_DIR_HOST)/share/hwinfo/
endef

define Build/Configure
	# Fetch prebuilt files from host build dir
	$(INSTALL_DIR) $(PKG_BUILD_DIR)/src/isdn/cdb/
	$(CP) $(STAGING_DIR_HOST)/share/hwinfo/isdn_cdb $(PKG_BUILD_DIR)/src/isdn/cdb/
	$(CP) $(STAGING_DIR_HOST)/share/hwinfo/mk_isdnhwdb $(PKG_BUILD_DIR)/src/isdn/cdb/
		
	$(INSTALL_DIR) $(PKG_BUILD_DIR)/src/ids/
	$(CP) $(STAGING_DIR_HOST)/share/hwinfo/check_hd $(PKG_BUILD_DIR)/src/ids/


	# Set copied files modtime to one day in the future
	# to prevent rebuilding them
	perl -e 'utime(time() + 86400, time() + 86400, $$$$ARGV[0])' \
		$(PKG_BUILD_DIR)/src/isdn/cdb/isdn_cdb
	perl -e 'utime(time() + 86400, time() + 86400, $$$$ARGV[0])' \
		$(PKG_BUILD_DIR)/src/isdn/cdb/mk_isdnhwdb
	perl -e 'utime(time() + 86400, time() + 86400, $$$$ARGV[0])' \
		$(PKG_BUILD_DIR)/src/ids/check_hd
endef


define Package/hwinfo
  SECTION:=utils
  CATEGORY:=Utilities
  TITLE:=probe the hardware present in the system
  URL:=https://github.com/openSUSE/hwinfo
  DEPENDS:= +libuuid
endef

define Package/hwinfo/description
 hwinfo/libhd are used to probe for the hardware present in the system.
 It can be used to generate a system overview log which can be later 
 used for support.
 This project provides a hardware probing library libhd.so and a 
 command line tool hwinfo using it. A major project using this library
 is YaST, the SUSE installation tool.
endef


define Package/hwinfo/install
	$(INSTALL_DIR) $(1)/usr/bin
	$(CP) $(PKG_BUILD_DIR)/hwinfo $(1)/usr/bin/
	$(INSTALL_DIR) $(1)/usr/lib
	$(CP) $(PKG_BUILD_DIR)/src/libhd.so* $(1)/usr/lib/
endef

$(eval $(call BuildPackage,hwinfo))
$(eval $(call HostBuild))