Skip to content

Commit

Permalink
Add tree target/command
Browse files Browse the repository at this point in the history
- Add tree.make

Signed-off-by: Abhisit Sangjan <[email protected]>
  • Loading branch information
abhisit committed Nov 19, 2024
1 parent d6a714d commit 5fd81be
Show file tree
Hide file tree
Showing 8 changed files with 111 additions and 1 deletion.
1 change: 1 addition & 0 deletions build-config/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,7 @@ include make/busybox.make
include make/zlib.make
include make/lzo.make
include make/util-linux.make
include make/tree.make
ifeq ($(MTDUTILS_ENABLE),yes)
include make/mtdutils.make
endif
Expand Down
3 changes: 3 additions & 0 deletions build-config/arch/armv7a.make
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ ETHTOOL_ENABLE ?= yes
# Include kexec-tools
KEXEC_ENABLE = yes

# Include tree
TREE_ENABLE ?= yes

# Update this if the configuration mechanism changes from one release
# to the next.
ONIE_CONFIG_VERSION = 1
Expand Down
3 changes: 3 additions & 0 deletions build-config/arch/armv8a.make
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,9 @@ ETHTOOL_ENABLE ?= yes
# Include kexec-tools
KEXEC_ENABLE = yes

# Include tree
TREE_ENABLE ?= yes

# Update this if the configuration mechanism changes from one release
# to the next.
ONIE_CONFIG_VERSION = 1
Expand Down
3 changes: 3 additions & 0 deletions build-config/arch/powerpc-softfloat.make
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ EXT3_4_ENABLE ?= yes
# Include btrfs file system tools
BTRFS_PROGS_ENABLE ?= yes

# Include tree
TREE_ENABLE ?= yes

PLATFORM_IMAGE_COMPLETE = $(IMAGE_BIN_STAMP) $(IMAGE_UPDATER_STAMP)
UPDATER_IMAGE_PARTS = $(UPDATER_ITB) $(UPDATER_UBOOT)
UPDATER_IMAGE_PARTS_COMPLETE = $(UPDATER_ITB) $(UBOOT_INSTALL_STAMP)
Expand Down
3 changes: 3 additions & 0 deletions build-config/arch/x86_64.make
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,9 @@ IPMITOOL_ENABLE ?= no
# Enable serial console support
SERIAL_CONSOLE_ENABLE ?= yes

# Include tree
TREE_ENABLE ?= yes

# Update this if the GRUB configuration mechanism changes from one
# release to the next.
ONIE_CONFIG_VERSION = 1
Expand Down
3 changes: 2 additions & 1 deletion build-config/make/images.make
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ PACKAGES_INSTALL_STAMPS += \
$(I2CTOOLS_INSTALL_STAMP) \
$(LVM2_INSTALL_STAMP) \
$(DMIDECODE_INSTALL_STAMP) \
$(ETHTOOL_INSTALL_STAMP)
$(ETHTOOL_INSTALL_STAMP) \
$(TREE_INSTALL_STAMP)

ifeq ($(GPT_ENABLE),yes)
PACKAGES_INSTALL_STAMPS += $(GPTFDISK_INSTALL_STAMP)
Expand Down
95 changes: 95 additions & 0 deletions build-config/make/tree.make
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
#-------------------------------------------------------------------------------
#
# Copyright (C) 2024 Abhisit Sangjan <[email protected]>
#
# SPDX-License-Identifier: GPL-2.0
#
#-------------------------------------------------------------------------------
#
# This is a makefile fragment that defines the build of tree
#

TREE_VERSION = 2.1.3
TREE_TARBALL = tree-$(TREE_VERSION).tar.gz
TREE_TARBALL_URLS += $(ONIE_MIRROR) \
https://gitlab.com/OldManProgrammer/unix-tree/-/archive/$(TREE_VERSION)
TREE_BUILD_DIR = $(USER_BUILDDIR)/tree
TREE_DIR = $(TREE_BUILD_DIR)/unix-tree-$(TREE_VERSION)-4fcfd4f68606be979ebb0ae4d3cc422a9e900ef9

TREE_DOWNLOAD_STAMP = $(DOWNLOADDIR)/tree-download
TREE_SOURCE_STAMP = $(USER_STAMPDIR)/tree-source
TREE_BUILD_STAMP = $(USER_STAMPDIR)/tree-build
TREE_INSTALL_STAMP = $(STAMPDIR)/tree-install
TREE_STAMP = $(TREE_DOWNLOAD_STAMP) \
$(TREE_SOURCE_STAMP) \
$(TREE_BUILD_STAMP) \
$(TREE_INSTALL_STAMP)

PHONY += tree \
tree-download \
tree-source \
tree-build \
tree-install \
tree-clean \
tree-download-clean

tree: $(TREE_STAMP)

DOWNLOAD += $(TREE_DOWNLOAD_STAMP)

tree-download: $(TREE_DOWNLOAD_STAMP)
$(TREE_DOWNLOAD_STAMP): $(PROJECT_STAMP)
$(Q) rm -f $@ && eval $(PROFILE_STAMP)
$(Q) echo "==== Getting upstream tree ===="
$(Q) $(SCRIPTDIR)/fetch-package $(DOWNLOADDIR) $(UPSTREAMDIR) \
$(TREE_TARBALL) $(TREE_TARBALL_URLS)
$(Q) touch $@

SOURCE += $(TREE_SOURCE_STAMP)

tree-source: $(TREE_SOURCE_STAMP)
$(TREE_SOURCE_STAMP): $(USER_TREE_STAMP) | $(TREE_DOWNLOAD_STAMP)
$(Q) rm -f $@ && eval $(PROFILE_STAMP)
$(Q) echo "==== Extracting upstream tree ===="
$(Q) $(SCRIPTDIR)/extract-package $(TREE_BUILD_DIR) $(DOWNLOADDIR)/$(TREE_TARBALL)
$(Q) touch $@

ifndef MAKE_CLEAN
TREE_NEW_FILES = $( \
shell test -d $(TREE_DIR) && \
test -f $(TREE_BUILD_STAMP) && \
find -L $(TREE_DIR) -newer $(TREE_BUILD_STAMP) -type f -print -quit \
)
endif

tree-build: $(TREE_BUILD_STAMP)
$(TREE_BUILD_STAMP): $(TREE_SOURCE_STAMP) $(TREE_NEW_FILES) | $(DEV_SYSROOT_INIT_STAMP)
$(Q) rm -f $@ && eval $(PROFILE_STAMP)
$(Q) echo "==== Building tree-$(TREE_VERSION) ===="
$(Q) sed -i 's/CC=gcc/CC=$(CROSSPREFIX)gcc/g' $(TREE_DIR)/Makefile
$(Q) PATH='$(CROSSBIN):$(PATH)' $(MAKE) -C $(TREE_DIR)
$(Q) touch $@

tree-install: $(TREE_INSTALL_STAMP)
$(TREE_INSTALL_STAMP): $(SYSROOT_INIT_STAMP) $(TREE_BUILD_STAMP)
$(Q) rm -f $@ && eval $(PROFILE_STAMP)
$(Q) echo "==== Installing tree in $(SYSROOTDIR) ===="
$(Q) mkdir -p $(SYSROOTDIR)/usr/bin/
$(Q) cp -av $(TREE_DIR)/tree $(SYSROOTDIR)/usr/bin/
$(Q) touch $@

USER_CLEAN += tree-clean
tree-clean:
$(Q) rm -rf $(TREE_BUILD_DIR)
$(Q) rm -f $(TREE_STAMP)
$(Q) echo "=== Finished making $@ for $(PLATFORM)"

DOWNLOAD_CLEAN += tree-download-clean
tree-download-clean:
$(Q) rm -f $(TREE_DOWNLOAD_STAMP) $(DOWNLOADDIR)/$(TREE_TARBALL)

#-------------------------------------------------------------------------------
#
# Local Variables:
# mode: makefile-gmake
# End:
1 change: 1 addition & 0 deletions upstream/tree-2.1.3.tar.gz.sha1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
61b152d5dc8271362314f240a0e21bdc079680ae tree-2.1.3.tar.gz

0 comments on commit 5fd81be

Please sign in to comment.