blob: 73b95912ee140ba1585db9fb391e7c0bd0bc9f6c [file] [log] [blame]
b.liue9582032025-04-17 19:18:16 +08001#
2# Copyright (C) 2015 OpenWrt.org
3#
4# This is free software, licensed under the GNU General Public License v2.
5# See /LICENSE for more information.
6#
7include $(TOPDIR)/rules.mk
8
9PKG_NAME:=coreutils
10PKG_CPE_ID:=cpe:/a:gnu:coreutils
11PKG_VERSION:=9.5
12
13PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
14PKG_SOURCE_URL:=@GNU/coreutils
15PKG_HASH:=767ae6a22950ec42f3ba5f7c1de79dd27800ee8e9b8642da5dedb5974a1741e5
16
17HOST_BUILD_PARALLEL := 1
18
19PKG_PROGRAMS:=date readlink touch ln chown ginstall
20
21include $(INCLUDE_DIR)/host-build.mk
22
23export GNULIB_SRCDIR:=$(HOST_GNULIB_SRCDIR)
24
25HOST_GNULIB_SKIP := \
26 lib/nstrftime.c \
27 lib/fprintftime.c \
28 lib/fcntl.in.h \
29 lib/locale.in.h
30
31HOST_CONFIGURE_ARGS += \
32 --enable-install-program=$(subst $(space),$(comma),$(strip $(PKG_PROGRAMS)))
33
34HOST_MAKE_FLAGS += \
35 $(AM_TOOL_PATHS_FAKE) \
36 PROGRAMS="$(patsubst %,src/%,$(PKG_PROGRAMS))" \
37 LIBRARIES= MANS= SUBDIRS=.
38
39define Host/Bootstrap
40 ( \
41 cd $(HOST_BUILD_DIR); \
42 $(AM_TOOL_PATHS_FAKE) \
43 ./bootstrap \
44 --bootstrap-sync \
45 --force \
46 --no-git \
47 --skip-po \
48 --gnulib-srcdir=$(GNULIB_SRCDIR) \
49 )
50endef
51
52define Host/Prepare
53 $(call Host/Prepare/Default)
54 $(if $(QUILT),,$(call Host/Bootstrap))
55endef
56
57define Host/Configure
58 $(if $(QUILT),$(call Host/Bootstrap))
59 $(foreach src,$(HOST_GNULIB_SKIP),mv -f $(HOST_BUILD_DIR)/$(src)~ $(HOST_BUILD_DIR)/$(src) || true; )
60 $(call Host/Configure/Default)
61endef
62
63define Host/Install
64 $(INSTALL_DIR) $(1)/bin
65 $(INSTALL_BIN) $(patsubst %,$(HOST_BUILD_DIR)/src/%,$(PKG_PROGRAMS)) $(1)/bin/
66 ln -sf ginstall $(1)/bin/install
67endef
68
69define Host/Uninstall
70 rm -f $(STAGING_DIR_HOST)/bin/install
71 -$(call Host/Compile/Default,uninstall)
72endef
73
74$(eval $(call HostBuild))