Skip to content

Commit

Permalink
add tools-host
Browse files Browse the repository at this point in the history
  • Loading branch information
fda77 committed Feb 17, 2021
1 parent 3d1c1e2 commit cc66c12
Show file tree
Hide file tree
Showing 6 changed files with 87 additions and 4 deletions.
2 changes: 2 additions & 0 deletions Makefile
Expand Up @@ -332,8 +332,10 @@ distclean: $(TOOLCHAIN_DISTCLEAN) $(TOOLS_DISTCLEAN) common-distclean

endif # FREETZ_HAVE_DOT_CONFIG!=y

#wrapper: $TOOL-host -> $TOOL-host-precompiled
$(filter-out $(TOOLS_BUILD_LOCAL),$(TOOLS)): % : $(if $(FREETZ_HOSTTOOLS_DOWNLOAD),tools-host,%-precompiled)
$(filter $(TOOLS_BUILD_LOCAL),$(TOOLS)): % : %-precompiled

tools: $(DL_DIR) $(SOURCE_DIR_ROOT) $(filter-out $(TOOLS_CONDITIONAL),$(TOOLS))
tools-dirclean: $(TOOLS_DIRCLEAN)
tools-distclean: $(TOOLS_DISTCLEAN)
Expand Down
10 changes: 8 additions & 2 deletions config/ui/build-system.in
Expand Up @@ -41,14 +41,20 @@ menu "Build system options"
and make/<pkg>/patches. If so, the package will be recreated.

comment "Host tools ------------------------------------------------------"
depends on FREETZ_SHOW_DEVELOPER

config FREETZ_HOSTTOOLS_STATIC
bool "Link statically"
depends on FREETZ_SHOW_DEVELOPER && !FREETZ_HOSTTOOLS_DOWNLOAD
depends on !FREETZ_HOSTTOOLS_DOWNLOAD && FREETZ_SHOW_DEVELOPER
default n
help
Usefull if you build an archive to download.

config FREETZ_HOSTTOOLS_DOWNLOAD
bool "Use precompiled i686 host-tools"
default y
help
Download and use precompiled binaries files. Not
every tool is included, see $(TOOLS_BUILD_LOCAL).

endmenu # "Build system options" #

4 changes: 2 additions & 2 deletions tools/.gitignore
@@ -1,5 +1,5 @@
/config/
/build/
/config
/build

/ash
/avm_kernel_config.bin2asm
Expand Down
41 changes: 41 additions & 0 deletions tools/dl-hosttools
@@ -0,0 +1,41 @@
#!/bin/bash
# packs host-tools to dl/tools-DATE.tar.xz in ~6min

miniconfig() {
local i
for i in "$@"; do echo "$i=y"; done
cat << EOF
FREETZ_USER_LEVEL_EXPERT=y
FREETZ_HOSTTOOLS_STATIC=n
FREETZ_HOSTTOOLS_DOWNLOAD=n
FREETZ_TOOLCHAIN_CCACHE=y
FREETZ_JLEVEL=9
EOF
}

SKIP="config yf"
FILE="tools-$(date '+%Y-%m-%d')"
OUTP="dl/$FILE.tar.xz"
[ -s "$OUTP" ] && echo "File $OUTP exists" && exit 1

TOOLS="$(ls tools/make/*/*.mk | sed 's!.*/!!;s/.mk$//g')"
LOCAL="$(sed -n 's/^TOOLS_BUILD_LOCAL.=//p' tools/make/Makefile.in)"
BUILD="$(echo "$TOOLS" | grep -vE "^$(echo $LOCAL | sed 's/ /|/g')$")"

TOOL_CONF=tools/config/conf
make distclean
rm -rf dl 2>/dev/null
ln -sf ~/.freetz-dl dl
mkdir -p dl
make $TOOL_CONF
miniconfig > .config
$TOOL_CONF --olddefconfig config/Config.in
cp -a .config "$FILE.conf"
time for x in $BUILD; do make $x; done 2>&1 | tee "$FILE.make" # 4min
for x in $LOCAL; do [ "$x" != "tools-host" ] && make $x-distclean; done
time sed -n 's,^/,tools/,p' tools/.gitignore | grep -vE "/(${SKIP// /|})$" | tar cvf - -T - | xz -9 - > "$OUTP" # 1min
du -h "$OUTP"
sha256sum "$OUTP"
ln -f "$OUTP"
echo "Created ${OUTP##*/}"

2 changes: 2 additions & 0 deletions tools/make/Makefile.in
Expand Up @@ -21,6 +21,7 @@ $(TOOLS_SOURCE_DIR) $(HOST_TOOLS_DIR):

TOOLS:=$(sort $(basename $(notdir $(wildcard $(TOOLS_DIR)/make/*/*.mk))))

# tools not built by default
TOOLS_CONDITIONAL+=gmp-host
TOOLS_CONDITIONAL+=mpc-host
TOOLS_CONDITIONAL+=mpfr-host
Expand All @@ -35,6 +36,7 @@ TOOLS_CONDITIONAL+=scons-host
TOOLS_CONDITIONAL+=tools-host
TOOLS_CONDITIONAL+=xdelta-host

# tools not in dl-archive
TOOLS_BUILD_LOCAL+=fakeroot-host
TOOLS_BUILD_LOCAL+=gmp-host
TOOLS_BUILD_LOCAL+=kconfig-host
Expand Down
32 changes: 32 additions & 0 deletions tools/make/tools-host/tools-host.mk
@@ -0,0 +1,32 @@
TOOLS_HOST_VERSION:=2021-02-17
TOOLS_HOST_SOURCE:=tools-$(TOOLS_HOST_VERSION).tar.xz
TOOLS_HOST_SOURCE_SHA256:=df8e0841b22eda7d7e916d16fddbaeec5a3d385c5fd2cfdf2223eff475f8d6b2
TOOLS_HOST_SITE:=@MIRROR/

TOOLS_HOST_DIR:=$(TOOLS_SOURCE_DIR)/tools-host-$(TOOLS_HOST_VERSION)


tools-host-source: $(DL_DIR)/$(TOOLS_HOST_SOURCE)
$(DL_DIR)/$(TOOLS_HOST_SOURCE): | $(DL_DIR)
$(DL_TOOL) $(DL_DIR) $(TOOLS_HOST_SOURCE) $(TOOLS_HOST_SITE) $(TOOLS_HOST_SOURCE_SHA256)

tools-host-unpacked: $(TOOLS_HOST_DIR)/.unpacked
$(TOOLS_HOST_DIR)/.unpacked: $(DL_DIR)/$(TOOLS_HOST_SOURCE) | $(TOOLS_SOURCE_DIR)
mkdir -p $(TOOLS_HOST_DIR)
tar -C $(TOOLS_HOST_DIR) $(VERBOSE) -xf $(DL_DIR)/$(TOOLS_HOST_SOURCE)
touch $@

$(TOOLS_HOST_DIR)/.installed: $(TOOLS_HOST_DIR)/.unpacked
cp -a $(TOOLS_HOST_DIR)/tools $(FREETZ_BASE_DIR)/
touch $@

tools-host-precompiled: $(TOOLS_HOST_DIR)/.installed


tools-host-clean:

tools-host-dirclean:
$(RM) -r $(TOOLS_HOST_DIR)

tools-host-distclean: tools-host-dirclean $(patsubst %,%-distclean,$(filter-out $(TOOLS_BUILD_LOCAL),$(TOOLS)))

0 comments on commit cc66c12

Please sign in to comment.