1
0
mirror of https://git.openwrt.org/openwrt/openwrt.git synced 2024-06-23 16:17:28 +02:00
openwrt/tools/coreutils/Makefile
Michael Pratt 09f8f21ae3
tools/coreutils: bootstrap to local gnulib source
Using the local gnulib source during bootstrap
allows for fine-grained control over the macros
and source files for use with coreutils
but part of gnulib instead of coreutils,
without having to wait for a release
or deal with gnulib as a git submodule.

In this case, the execution of autotools
must be skipped by force.
Autoconf and Automake during bootstrap on coreutils
only works right when using directly checked-out source.

There is a symbol in gnulib, @GNULIB_TIME@
that is not yet defined in coreutils source,
so we use the backup of lib/time.in.h instead
of the one provided by gnulib source.

Signed-off-by: Michael Pratt <mcpratt@pm.me>
2023-05-04 06:07:30 +02:00

71 lines
1.6 KiB
Makefile

#
# Copyright (C) 2015 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=coreutils
PKG_CPE_ID:=cpe:/a:gnu:coreutils
PKG_VERSION:=9.3
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
PKG_SOURCE_URL:=@GNU/coreutils
PKG_HASH:=adbcfcfe899235b71e8768dcf07cd532520b7f54f9a8064843f8d199a904bbaa
HOST_BUILD_PARALLEL := 1
BUILD_PROGRAMS = date readlink touch ln chown ginstall
include $(INCLUDE_DIR)/host-build.mk
export GNULIB_SRCDIR:=$(HOST_GNULIB_SRCDIR)
BUILD_BINS = $(patsubst %,src/%,$(BUILD_PROGRAMS))
HOST_CONFIGURE_ARGS += \
--enable-install-program=$(subst $(space),$(comma),$(strip $(BUILD_PROGRAMS)))
HOST_MAKE_FLAGS += \
$(AM_TOOL_PATHS_FAKE) \
PROGRAMS="$(BUILD_BINS)" \
LIBRARIES= MANS= SUBDIRS=.
define Host/Bootstrap
( \
cd $(HOST_BUILD_DIR); \
$(AM_TOOL_PATHS_FAKE) \
./bootstrap \
--bootstrap-sync \
--force \
--no-git \
--skip-po \
--gnulib-srcdir=$(GNULIB_SRCDIR) \
)
endef
define Host/Prepare
$(call Host/Prepare/Default)
$(if $(QUILT),,$(call Host/Bootstrap))
endef
define Host/Configure
$(if $(QUILT),$(call Host/Bootstrap))
-$(CP) $(HOST_BUILD_DIR)/lib/time.in.h~ $(HOST_BUILD_DIR)/lib/time.in.h # @GNULIB_TIME@ not defined
$(call Host/Configure/Default)
endef
define Host/Install
$(INSTALL_DIR) $(1)/bin
$(INSTALL_BIN) $(patsubst %,$(HOST_BUILD_DIR)/%,$(BUILD_BINS)) $(1)/bin/
ln -sf ginstall $(1)/bin/install
endef
define Host/Uninstall
rm -f $(STAGING_DIR_HOST)/bin/install
-$(call Host/Compile/Default,uninstall)
endef
$(eval $(call HostBuild))