Skip to content

Slim full builds #61

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Apr 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/pr-pipeline.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:

strategy:
matrix:
build_type: ["build", "build-with-python"]
build_type: ["slim", "full"]
architecture: ["x86_64", "arm", "aarch64", "powerpc", "mips", "mipsel"]

runs-on: ubuntu-latest
Expand All @@ -25,4 +25,4 @@ jobs:
run: sudo apt-get install -y wget

- name: Build
run: make ${{ matrix.build_type }}-${{ matrix.architecture }} -j$((`nproc`+1))
run: make build-${{ matrix.architecture }}-${{ matrix.build_type }} -j$((`nproc`+1))
47 changes: 26 additions & 21 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
ARCHS := x86_64 arm aarch64 powerpc mips mipsel
GDB_BFD_ARCHS := $(shell echo $(ARCHS) | awk '{for(i=1;i<=NF;i++) $$i=$$i"-linux"; print}' OFS=,)

TARGETS := $(addprefix build-, $(ARCHS))
PYTHON_TARGETS := $(addprefix build-with-python-, $(ARCHS))
ALL_TARGETS := $(TARGETS) $(PYTHON_TARGETS)
BASE_BUILD_TARGETS := $(addprefix build-, $(ARCHS))

PACK_TARGETS := $(addprefix pack-, $(ARCHS))
PYTHON_PACK_TARGETS := $(addprefix pack-with-python-, $(ARCHS))
ALL_PACK_TARGETS := $(PACK_TARGETS) $(PYTHON_PACK_TARGETS)
SLIM_BUILD_TARGETS := $(addsuffix -slim, $(BASE_BUILD_TARGETS))
FULL_BUILD_TARGETS := $(addsuffix -full, $(BASE_BUILD_TARGETS))
ALL_BUILD_TARGETS := $(SLIM_BUILD_TARGETS) $(FULL_BUILD_TARGETS)

BASE_PACK_TARGETS := $(addprefix pack-, $(ARCHS))

FULL_PACK_TARGETS := $(addsuffix -full, $(BASE_PACK_TARGETS))
SLIM_PACK_TARGETS := $(addsuffix -slim, $(BASE_PACK_TARGETS))
ALL_PACK_TARGETS := $(SLIM_PACK_TARGETS) $(FULL_PACK_TARGETS)

SUBMODULE_PACKAGES := $(wildcard src/submodule_packages/*)
BUILD_PACKAGES_DIR := "build/packages"
Expand All @@ -15,7 +20,7 @@ BUILD_PACKAGES_DIR := "build/packages"
# This is disabled by the ci automation manually.
TTY_ARG ?= -it

.PHONY: clean help download_packages build build-docker-image $(ALL_TARGETS) $(ALL_PACK_TARGETS)
.PHONY: clean help download_packages build build-docker-image $(ALL_BUILD_TARGETS) $(ALL_PACK_TARGETS)

.NOTPARALLEL: build pack

Expand All @@ -24,7 +29,7 @@ help:
@echo " make build"
@echo ""

@for target in $(ALL_TARGETS); do \
@for target in $(ALL_BUILD_TARGETS); do \
echo " $$target"; \
done

Expand Down Expand Up @@ -53,31 +58,31 @@ symlink-git-packages: build/symlink-git-packages.stamp

download-packages: build/download-packages.stamp

build: $(ALL_TARGETS)
build: $(ALL_BUILD_TARGETS)

$(TARGETS): build-%:
@$(MAKE) _build-$*
$(SLIM_BUILD_TARGETS): build-%-slim:
@BUILD_TYPE="slim" $(MAKE) _build-$*

$(PYTHON_TARGETS): build-with-python-%:
@WITH_PYTHON="--with-python" $(MAKE) _build-$*
$(FULL_BUILD_TARGETS): build-%-full:
@BUILD_TYPE="full" GDB_BFD_ARCHS=$(GDB_BFD_ARCHS) $(MAKE) _build-$*

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

pack: $(ALL_PACK_TARGETS)

$(PACK_TARGETS): pack-%:
@$(MAKE) _pack-$*
$(SLIM_PACK_TARGETS): pack-%-slim:
@BUILD_TYPE="slim" $(MAKE) _pack-$*

$(PYTHON_PACK_TARGETS): pack-with-python-%:
@TAR_EXT="with-python-" ARTIFACT_EXT="_with_python" $(MAKE) _pack-$*
$(FULL_PACK_TARGETS): pack-%-full:
@BUILD_TYPE="full" $(MAKE) _pack-$*

_pack-%: build-%
if [ ! -f "build/artifacts/gdb-static-$(TAR_EXT)$*.tar.gz" ]; then \
tar -czf "build/artifacts/gdb-static-$(TAR_EXT)$*.tar.gz" -C "build/artifacts/$*$(ARTIFACT_EXT)" .; \
_pack-%: build-%-$(BUILD_TYPE)
if [ ! -f "build/artifacts/gdb-static-$(BUILD_TYPE)-$*.tar.gz" ]; then \
tar -czf "build/artifacts/gdb-static-$(BUILD_TYPE)-$*.tar.gz" -C "build/artifacts/$*_$(BUILD_TYPE)" .; \
fi

clean-git-packages:
Expand Down
23 changes: 15 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,22 @@ This is where `gdb-static` comes in! We provide static builds of `gdb` (and `gdb

## Usage

To get started with `gdb-static`, simply download the build for your architecture from the [releases page](https://github.com/guyush1/gdb-static/releases/latest), extract the archive, and copy the binary to your desired platform.

> [!NOTE]
> We provide two types of builds:
> 1. Builds with Python support, which are approximately ~30 MB in size.
> 2. Slimmer builds without Python support, which are approximately ~7 MB in size.
To get started with `gdb-static`, simply download the build for your architecture from the [releases page](https://github.com/guyush1/gdb-static/releases/latest), extract the archive, and copy the binary to your desired platform. <br />

You may choose to copy the `gdb` binary to the platform, or use `gdbserver` to debug remotely.

## Build types

We provide two types of builds:
1. Slim builds, that contains most of the features, beside the ones mentioned below.
2. Full builds that contains all of the slim build features, and also contains:
* Python support
* Cross-architecture debugging. <br />
Note that in order to enable cross-architecture debugging, we have to disable the simulator feature, since not all targets have a simulator.

Slim builds are approximately ~10MB. Full builds are approximately ~70MB. <br />
You can edit the full_build_conf.sh file to disable full build exclusive features.

## Development

> [!NOTE]
Expand Down Expand Up @@ -97,10 +104,10 @@ Building for a specific architecture
To build `gdb-static` for a specific architecture, run the following command:

```bash
make build[-with-python]-<ARCH>
make build-<ARCH>-[slim/full]
```

Where `<ARCH>` is the architecture you want to build for, and `-with-python` may be added in order to compile gdb with Python support.
Where `<ARCH>` is the architecture you want to build for, and `slim/full` determines the build type (see [here](#build-types)).

The resulting binary will be placed in the `build/artifacts/` directory:

Expand Down
Loading