Skip to content

Commit

Permalink
Add submodules to build/packages
Browse files Browse the repository at this point in the history
Using symlinks the submodules are added to appear just like any
downloaded unpacked tar.

Also added a Makefile clean rule to clean the submodules, which
includes Reseting the submodules to the origin branch state,
including ignored files.
  • Loading branch information
roddyrap committed Dec 21, 2024
1 parent 6cc9c0c commit 2454257
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 7 deletions.
23 changes: 17 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
ARCHS := x86_64 arm aarch64 powerpc mips mipsel
TARGETS := $(addprefix build-, $(ARCHS))
PACK_TARGETS := $(addprefix pack-, $(ARCHS))
SUBMODULE_PACKAGES := $(wildcard src/submodule_packages/*)
BUILD_PACKAGES_DIR := "build/packages"

.PHONY: clean help download_packages build build-docker-image $(TARGETS) $(PACK_TARGETS)

Expand All @@ -23,22 +25,28 @@ build/build-docker-image.stamp: Dockerfile

build-docker-image: build/build-docker-image.stamp

build/download-packages.stamp: build/build-docker-image.stamp src/download_packages.sh
mkdir -p build/packages
build/download-packages.stamp: build/build-docker-image.stamp src/compilation/download_packages.sh
mkdir -p $(BUILD_PACKAGES_DIR)
docker run --user $(shell id -u):$(shell id -g) \
--rm --volume .:/app/gdb gdb-static env TERM=xterm-256color \
/app/gdb/src/download_packages.sh /app/gdb/build/packages
/app/gdb/src/compilation/download_packages.sh /app/gdb/$(BUILD_PACKAGES_DIR)/
touch build/download-packages.stamp

build/symlink-git-packages.stamp: $(SUBMODULE_PACKAGES)
mkdir -p $(BUILD_PACKAGES_DIR)
ln -sf $(addprefix /app/gdb/, $(SUBMODULE_PACKAGES)) $(BUILD_PACKAGES_DIR)/

symlink-git-packages: build/symlink-git-packages.stamp

download-packages: build/download-packages.stamp

build: $(TARGETS)

$(TARGETS): build-%: download-packages build-docker-image
$(TARGETS): build-%: symlink-git-packages download-packages build-docker-image
mkdir -p build
docker run --user $(shell id -u):$(shell id -g) \
--rm --volume .:/app/gdb gdb-static env TERM=xterm-256color \
/app/gdb/src/build.sh $* /app/gdb/build/ /app/gdb/src
/app/gdb/src/compilation/build.sh $* /app/gdb/build/ /app/gdb/src

pack: $(PACK_TARGETS)

Expand All @@ -47,7 +55,10 @@ $(PACK_TARGETS): pack-%: build-%
tar -czf "build/artifacts/gdb-static-$*.tar.gz" -C "build/artifacts/$*" .; \
fi

clean:
clean-git-packages:
git submodule foreach '[[ ! "$$sm_path" == src/submodule_packages/* ]] || git clean -xffd'

clean: clean-git-packages
rm -rf build
# Kill and remove all containers of image gdb-static
docker ps -a | grep -P "^[a-f0-9]+\s+gdb-static\s+" | awk '{print $$1}' | xargs docker rm -f 2>/dev/null || true
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/submodule_packages/cpython-static

0 comments on commit 2454257

Please sign in to comment.