From 7b108f326a118051ec9e09164246c487d606771e Mon Sep 17 00:00:00 2001 From: Emery Hemingway Date: Sun, 24 Mar 2019 13:06:04 +0100 Subject: [PATCH] WiP! public makefiles --- Tupfile | 44 ++++++++++++++++++++++ Tuprules.tup | 21 +++++++++-- errata/pkg.mk.awk | 15 ++++++++ index/index.xml => index.xml | 0 index/Tupfile | 32 ---------------- libretro/Tuprules.tup | 3 ++ libretro/cores/Tuprules.tup | 9 +++-- libretro/cores/nxengine/Tuprules.tup | 7 ++++ runtimes/cave_story/Tuprules.tup | 12 ++++-- runtimes/cave_story/cave_story-en/Tupfile | 23 ++++++----- runtimes/cave_story/cave_story-en/archives | 6 --- tup.config | 3 ++ 12 files changed, 118 insertions(+), 57 deletions(-) create mode 100644 Tupfile create mode 100644 errata/pkg.mk.awk rename index/index.xml => index.xml (100%) delete mode 100644 index/Tupfile create mode 100644 libretro/Tuprules.tup delete mode 100644 runtimes/cave_story/cave_story-en/archives diff --git a/Tupfile b/Tupfile new file mode 100644 index 000000000..8b0a2fec5 --- /dev/null +++ b/Tupfile @@ -0,0 +1,44 @@ +include_rules + +ifndef SCULPT_VERSION +error CONFIG_SCULPT_VERSION is undefined +endif + +: $(DEPOT_DIR)/ $(DEPOT_DIR)/ |> \ + for f in %; do tail -n1 $f >> %o; done; \ + for f in %; do echo $f | awk -F / '{print "local/raw/"$4"/"$5}' - >> %o; done; \ +|> $(BIN_LISTING) + # Generate a listing of all binary archives + +: $(DEPOT_DIR)/ |> \ + echo PUBLIC_USER=@(PUBLIC_USER) >> %o; \ + echo PUBLIC_KEY=@(PUBLIC_KEY) >> %o; \ + for f in %; \ + do \ + b2sum -l 24 $f | awk -f errata/pkg.mk.awk >> %o; \ + done; \ +|> Makefile + # Generate the makefile for creating signed tarballs + +DEPOT_INDEX_FILE = $(DEPOT_DIR)/index/@(SCULPT_VERSION) + +ifneq (@(DEPOT_USER),local) +: index.xml |> tup varsed %f - | xmllint - > %o |> $(DEPOT_INDEX_FILE) {index} +else +: $(DEPOT_DIR)/ $(DEPOT_DIR)/ |> ^ generate index^ \ + echo '' > %o; \ + echo ' ' >> %o; \ + echo % | tr ' ' '\n' | sort |\ + sed \ + -e 's|depot/| |' \ + - >> %o; \ + echo ' ' >> %o; \ + echo % | tr ' ' '\n' | sort |\ + sed \ + -e 's|depot/| |' \ + - >> %o; \ + echo '' >> %o |> $(DEPOT_INDEX_FILE) {index} +endif + # Generate the depot index file diff --git a/Tuprules.tup b/Tuprules.tup index 499fe1a55..a353db847 100644 --- a/Tuprules.tup +++ b/Tuprules.tup @@ -1,5 +1,14 @@ .gitignore +BIN_LISTING = $(TUP_CWD)/bin-list +PKG_LISTING = $(TUP_CWD)/pkg-list + +!collect_pkg_archives = |> ^ COLLECT pkg/%d/archives^ cp %f %o \ + |> $(DEPOT_PKG_DIR)/%d/@(DEPOT_VERSION)/archives $(DEPOT_DIR)/ + +!collect_pkg_runtime = |> ^ COLLECT pkg/%d/runtime^ cp %f %o \ + |> $(DEPOT_PKG_DIR)/%d/@(DEPOT_VERSION)/runtime $(DEPOT_DIR)/ + SDK_INCLUDE = $(TUP_CWD)/sdk.tup export PKG_CONFIG_PATH @@ -13,6 +22,10 @@ ifndef DEPOT_VERSION error CONFIG_DEPOT_VERSION is undefined endif +BIN_VERSION=current +PKG_VERSION=current +RAW_VERSION=current + DEPOT_DIR = $(TUP_CWD)/depot/@(DEPOT_USER) PUBLIC_DIR = $(TUP_CWD)/public/@(DEPOT_USER) @@ -29,11 +42,13 @@ PUBLIC_RAW_DIR = $(PUBLIC_DIR)/raw ERRATA_DIR = $(TUP_CWD)/errata -!archives_to_depot = |> ^ varse %d archives^ tup varsed %f %o |> $(DEPOT_PKG_DIR)/%d/@(DEPOT_VERSION)/archives +!archives_to_depot = |> |> +#!archives_to_depot = |> ^ varse %d archives^ tup varsed %f %o |> $(DEPOT_PKG_DIR)/%d/@(DEPOT_VERSION)/archives -!runtime_to_depot = |> ^ validate %d runtime^ \ +!runtime_to_depot = |> |> +#!runtime_to_depot = |> ^ validate %d runtime^ \ xmllint -schema $(ERRATA_DIR)/runtime.xsd --noout %f ; cp %f %o \ -|> $(DEPOT_PKG_DIR)/%d/@(DEPOT_VERSION)/runtime $(DEPOT_DIR)/ +|> $(DEPOT_PKG_DIR)/%d/@(DEPOT_VERSION)/runtime !pkg_extra_to_depot = |> ^ CP %o^ cp %f %o |> $(DEPOT_PKG_DIR)/%d/@(DEPOT_VERSION)/%b diff --git a/errata/pkg.mk.awk b/errata/pkg.mk.awk new file mode 100644 index 000000000..aabf62626 --- /dev/null +++ b/errata/pkg.mk.awk @@ -0,0 +1,15 @@ +{ split($2,a,"/") } +{ src=a[1]"/"a[2]"/"a[3]"/"a[4]"/"a[5] } +{ tar="public/$(PUBLIC_USER)/pkg/"a[4]"/"$1".tar.xz" } +{ sig=tar".sig" } + +{ print sig": "tar} +{ print " gpg --detach-sign --digest-algo SHA256 --no-tty --local-user $(PUBLIC_KEY) < $< > tmp" } +{ print " mv tmp $@" } + +{ print tar": "$2 } +{ print " mkdir -p $(dir $@) "$1 } +{ print " cp "src"/* "$1 } +{ print " sed 's|^local/|$(PUBLIC_USER)/|' "src"/archives > "$1"/archives" } +{ print " tar cfj $@ "$1 } +{ print " rm -r " $1 } diff --git a/index/index.xml b/index.xml similarity index 100% rename from index/index.xml rename to index.xml diff --git a/index/Tupfile b/index/Tupfile deleted file mode 100644 index 318e33ede..000000000 --- a/index/Tupfile +++ /dev/null @@ -1,32 +0,0 @@ -include_rules - -ifndef SCULPT_VERSION -error CONFIG_SCULPT_VERSION is undefined -endif - -DEPOT_INDEX_FILE = $(DEPOT_DIR)/index/@(SCULPT_VERSION) - -ifneq (@(DEPOT_USER),local) -: index.xml |> tup varsed %f - | xmllint - > %o |> $(DEPOT_INDEX_FILE) {index} -else -: $(DEPOT_DIR)/ $(DEPOT_DIR)/ |> ^ generate index^ \ - echo '' > %o; \ - echo ' ' >> %o; \ - echo % | tr ' ' '\n' | sort |\ - sed \ - -e 's|\.\./depot/| |' \ - - >> %o; \ - echo ' ' >> %o; \ - echo % | tr ' ' '\n' | sort |\ - sed \ - -e 's|\.\./depot/| |' \ - - >> %o; \ - echo '' >> %o |> $(DEPOT_INDEX_FILE) {index} -endif - -ifdef DEPOT_KEY -: {index} |> xz -c %f > %o |> $(PUBLIC_DIR)/index/%b.xz {dist} -: {dist} |> !public_signature |> -endif diff --git a/libretro/Tuprules.tup b/libretro/Tuprules.tup new file mode 100644 index 000000000..b337ba5aa --- /dev/null +++ b/libretro/Tuprules.tup @@ -0,0 +1,3 @@ +LIBRETRO_COMM_DIR = $(TUP_CWD)/libretro-common +GIT_VERSION = `git describe --always` +BIN_VERSION = $(GIT_VERSION) diff --git a/libretro/cores/Tuprules.tup b/libretro/cores/Tuprules.tup index 210d0cb2d..d297b3a1e 100644 --- a/libretro/cores/Tuprules.tup +++ b/libretro/cores/Tuprules.tup @@ -28,7 +28,12 @@ DEPOT_NAME = libretro-$(TARGET_NAME) !publish_core = | libretro.so |> ^ STRIP %f^ \ strip -o %o %f \ -|> $(DEPOT_BIN_DIR)/$(DEPOT_NAME)/@(DEPOT_VERSION)/%b\ +|> $(DEPOT_BIN_DIR)/$(DEPOT_NAME)/@(DEPOT_VERSION)/%b + +!bin_archives = |> \ + echo $(REMOTE_DEPENDS) _/src/$(DEPOT_NAME)/$(BIN_VERSION) | tr ' ' '\n' > %o; \ +|> $(DEPOT_BIN_DIR)/$(DEPOT_NAME)/@(DEPOT_VERSION)/_archives \ + $(DEPOT_DIR)/ !publish_core_raw = |> ^o copy %b^ cp %f %o \ |> $(DEPOT_RAW_DIR)/$(DEPOT_NAME)/@(DEPOT_VERSION)/%b @@ -73,5 +78,3 @@ endif LINK_T = $(TUP_CWD)/link.T DEFINES += -D__LIBRETRO__ -DFRONTEND_SUPPORTS_RGB565 NO_UNDEFINED = --no-undefined - -LIBRETRO_COMM_DIR = $(TUP_CWD)/../libretro-common diff --git a/libretro/cores/nxengine/Tuprules.tup b/libretro/cores/nxengine/Tuprules.tup index 33295fa8b..85ff29c29 100644 --- a/libretro/cores/nxengine/Tuprules.tup +++ b/libretro/cores/nxengine/Tuprules.tup @@ -22,3 +22,10 @@ CXXFLAGS += -fno-rtti -fno-exceptions : {binary} |> !core_publish_bin |> : {package} |> !core_publish_pkg |> + +REMOTE_DEPENDS += \ + @(SDK_USER)/src/vfs/@(SDK_VERSION) \ + @(SDK_USER)/src/libc/@(SDK_VERSION) \ + @(SDK_USER)/src/stdcxx/@(SDK_VERSION) \ + +: |> !bin_archives |> diff --git a/runtimes/cave_story/Tuprules.tup b/runtimes/cave_story/Tuprules.tup index 56960ce9c..eabac862f 100644 --- a/runtimes/cave_story/Tuprules.tup +++ b/runtimes/cave_story/Tuprules.tup @@ -1,3 +1,9 @@ -: archives |> !archives_to_depot |> {package} -: ../runtime |> !runtime_to_depot |> {package} -: {package} |> !publish_pkg |> +: $(BIN_LISTING) |> ^ GENERATE %o^ \ + echo $(REMOTE_DEPENDS) | tr ' ' '\n' > archives; \ + for i in $(LOCAL_DEPENDS); do \ + grep $i %f >> archives; \ + done; \ +|> archives + +: ../runtime |> !collect_pkg_runtime |> +: archives |> !collect_pkg_archives |> diff --git a/runtimes/cave_story/cave_story-en/Tupfile b/runtimes/cave_story/cave_story-en/Tupfile index fcc7a0a30..fef9d95b7 100644 --- a/runtimes/cave_story/cave_story-en/Tupfile +++ b/runtimes/cave_story/cave_story-en/Tupfile @@ -1,16 +1,19 @@ +REMOTE_DEPENDS += \ + @(SDK_USER)/src/vfs/@(SDK_VERSION) \ + @(SDK_USER)/src/libc/@(SDK_VERSION) \ + @(SDK_USER)/src/stdcxx/@(SDK_VERSION) \ + +LOCAL_DEPENDS += \ + _/src/libretro-nxengine \ + _/src/retro_frontend \ + _/raw/cave_story-en \ + include_rules : |> wget --quiet https://www.cavestory.org/downloads/%o |> cavestoryen.zip {zip} -VERSION = 2004.12 +RAW_VERSION = 2004.12 : {zip} \ - |> unzip -D %f -d tmp ; tar cf %o -C tmp/CaveStory . ; rm -r tmp \ - |> $(DEPOT_RAW_DIR)/%d/$(VERSION)/doukutsu.tar {raw} - -!publish_raw = |> ^o publish %d raw^ \ - tar cfJ %o -C $(DEPOT_RAW_DIR)/%d . ; $(SIGN_CMD) < %o > %o.sig \ -|> $(PUBLIC_RAW_DIR)/%d/$(VERSION).tar.xz \ -| $(PUBLIC_RAW_DIR)/%d/$(VERSION).tar.xz.sig - -: {raw} |> !publish_raw |> + |> unzip -qD %f -d tmp ; tar cf %o -C tmp/CaveStory . ; rm -r tmp \ + |> $(DEPOT_RAW_DIR)/%d/$(RAW_VERSION)/doukutsu.tar $(DEPOT_DIR)/ diff --git a/runtimes/cave_story/cave_story-en/archives b/runtimes/cave_story/cave_story-en/archives deleted file mode 100644 index f8dab0551..000000000 --- a/runtimes/cave_story/cave_story-en/archives +++ /dev/null @@ -1,6 +0,0 @@ -@SDK_USER@/src/vfs/@SDK_VERSION@ -@SDK_USER@/src/libc/@SDK_VERSION@ -@SDK_USER@/src/stdcxx/@SDK_VERSION@ -@DEPOT_USER@/src/retro_frontend/@DEPOT_VERSION@ -@DEPOT_USER@/src/libretro-nxengine/@DEPOT_VERSION@ -@DEPOT_USER@/raw/cave_story-en/2004.12 diff --git a/tup.config b/tup.config index 269fa7b1c..dfa785dce 100644 --- a/tup.config +++ b/tup.config @@ -7,5 +7,8 @@ CONFIG_DEPOT_USER=local CONFIG_DEPOT_VERSION=current #CONFIG_DEPOT_KEY=6E10414EE7160781F5FEE8FFB14D043A26B3D2C7 +CONFIG_PUBLIC_USER=ehmry +CONFIG_PUBLIC_KEY=6E10414EE7160781F5FEE8FFB14D043A26B3D2C7 + CONFIG_PUBLIC_SRC_MESA=nfeske/src/mesa/2019-02-19 CONFIG_PUBLIC_SRC_EXPAT=nfeske/src/expat/2019-02-19