mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-21 14:37:50 +00:00
a52541de18
This patch changes the depot layout such that each archive is represented as a directory that contains the versions of the archive as subdirectories. Issue #2610
94 lines
2.3 KiB
Makefile
Executable File
94 lines
2.3 KiB
Makefile
Executable File
#!/usr/bin/make -f
|
|
|
|
#
|
|
# \brief Tool for assembling a source archive
|
|
# \author Norman Feske
|
|
# \date 2016-05-13
|
|
#
|
|
|
|
define HELP_MESSAGE
|
|
|
|
Tool for assembling a source archive
|
|
|
|
usage:
|
|
|
|
$(firstword $(MAKEFILE_LIST)) <src-name> USER=<user>
|
|
|
|
<src-name> name of the source archive
|
|
<user> identity of the archive creator
|
|
|
|
endef
|
|
|
|
export GENODE_DIR := $(realpath $(dir $(MAKEFILE_LIST))/../../..)
|
|
|
|
include $(GENODE_DIR)/tool/depot/mk/front_end.inc
|
|
|
|
#
|
|
# The target is the name of the archive
|
|
#
|
|
ARCHIVE := $(TARGET)
|
|
TAG_FILE := LICENSE
|
|
|
|
ifeq ($(USER),)
|
|
$(error USER undefined)
|
|
endif
|
|
|
|
#
|
|
# Define location of recipe and the exported archive
|
|
#
|
|
RECIPE_DIR := $(call recipe_dir,src/$(ARCHIVE))
|
|
REP_DIR := $(RECIPE_DIR:/recipes/src/$(ARCHIVE)=)
|
|
DEPOT_SUB_DIR := $(DEPOT_DIR)/$(USER)/src
|
|
|
|
#
|
|
# Include common archive-creation steps
|
|
#
|
|
include $(GENODE_DIR)/tool/depot/mk/extract.inc
|
|
include $(GENODE_DIR)/tool/depot/mk/extract_content.inc
|
|
|
|
#
|
|
# Add used_apis information, supplemented with the current API hashes
|
|
#
|
|
ifneq ($(wildcard $(RECIPE_DIR)/used_apis),)
|
|
$(DEPOT_ARCHIVE_DIR).hash: $(DEPOT_ARCHIVE_DIR)/used_apis
|
|
endif
|
|
|
|
$(DEPOT_ARCHIVE_DIR)/used_apis: $(DEPOT_ARCHIVE_DIR)
|
|
$(DEPOT_ARCHIVE_DIR)/used_apis: $(RECIPE_DIR)/used_apis
|
|
$(VERBOSE) \
|
|
for api in $(shell cat $<); do \
|
|
hash_file=$(GENODE_DIR)/repos/**/recipes/api/$$api/hash; \
|
|
if [ ! -f $$hash_file ]; then \
|
|
echo "Error: archive $(ARCHIVE) depends on nonexisting API '$$api',"; \
|
|
echo " expected $$hash_file"; \
|
|
rm -r $(DEPOT_ARCHIVE_DIR); \
|
|
result=false; \
|
|
break; \
|
|
fi; \
|
|
hash_file_content=$$(< $$hash_file); \
|
|
version=$${hash_file_content%% *}; \
|
|
echo "$$api/$$version" >> $@; \
|
|
done; $$result
|
|
|
|
#
|
|
# If the archive is a library, add the hash of its implemented API
|
|
#
|
|
ifneq ($(wildcard $(RECIPE_DIR)/api),)
|
|
$(DEPOT_ARCHIVE_DIR).hash: $(DEPOT_ARCHIVE_DIR)/api
|
|
endif
|
|
$(DEPOT_ARCHIVE_DIR)/api: $(DEPOT_ARCHIVE_DIR)
|
|
$(DEPOT_ARCHIVE_DIR)/api: $(RECIPE_DIR)/api
|
|
$(VERBOSE) \
|
|
api=$$(< $<); \
|
|
hash_file=$(GENODE_DIR)/repos/**/recipes/api/$$api/hash; \
|
|
if [ ! -f $$hash_file ]; then \
|
|
echo "Error: library '$(ARCHIVE)' implements unknown API '$$api',"; \
|
|
echo " expected $$hash_file"; \
|
|
rm -r $(DEPOT_ARCHIVE_DIR); \
|
|
exit -1; \
|
|
fi; \
|
|
hash_file_content=$$(< $$hash_file); \
|
|
version=$${hash_file_content%% *}; \
|
|
echo "$$api/$$version" >> $@;
|
|
|