Skip to content

Commit 97f2b84

Browse files
authored
Merge pull request #61 from guyush1/slim-full-builds
Slim full builds
2 parents 1956fde + e4e5dbb commit 97f2b84

File tree

5 files changed

+163
-105
lines changed

5 files changed

+163
-105
lines changed

.github/workflows/pr-pipeline.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212

1313
strategy:
1414
matrix:
15-
build_type: ["build", "build-with-python"]
15+
build_type: ["slim", "full"]
1616
architecture: ["x86_64", "arm", "aarch64", "powerpc", "mips", "mipsel"]
1717

1818
runs-on: ubuntu-latest
@@ -25,4 +25,4 @@ jobs:
2525
run: sudo apt-get install -y wget
2626

2727
- name: Build
28-
run: make ${{ matrix.build_type }}-${{ matrix.architecture }} -j$((`nproc`+1))
28+
run: make build-${{ matrix.architecture }}-${{ matrix.build_type }} -j$((`nproc`+1))

Makefile

+26-21
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
ARCHS := x86_64 arm aarch64 powerpc mips mipsel
2+
GDB_BFD_ARCHS := $(shell echo $(ARCHS) | awk '{for(i=1;i<=NF;i++) $$i=$$i"-linux"; print}' OFS=,)
23

3-
TARGETS := $(addprefix build-, $(ARCHS))
4-
PYTHON_TARGETS := $(addprefix build-with-python-, $(ARCHS))
5-
ALL_TARGETS := $(TARGETS) $(PYTHON_TARGETS)
4+
BASE_BUILD_TARGETS := $(addprefix build-, $(ARCHS))
65

7-
PACK_TARGETS := $(addprefix pack-, $(ARCHS))
8-
PYTHON_PACK_TARGETS := $(addprefix pack-with-python-, $(ARCHS))
9-
ALL_PACK_TARGETS := $(PACK_TARGETS) $(PYTHON_PACK_TARGETS)
6+
SLIM_BUILD_TARGETS := $(addsuffix -slim, $(BASE_BUILD_TARGETS))
7+
FULL_BUILD_TARGETS := $(addsuffix -full, $(BASE_BUILD_TARGETS))
8+
ALL_BUILD_TARGETS := $(SLIM_BUILD_TARGETS) $(FULL_BUILD_TARGETS)
9+
10+
BASE_PACK_TARGETS := $(addprefix pack-, $(ARCHS))
11+
12+
FULL_PACK_TARGETS := $(addsuffix -full, $(BASE_PACK_TARGETS))
13+
SLIM_PACK_TARGETS := $(addsuffix -slim, $(BASE_PACK_TARGETS))
14+
ALL_PACK_TARGETS := $(SLIM_PACK_TARGETS) $(FULL_PACK_TARGETS)
1015

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

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

2025
.NOTPARALLEL: build pack
2126

@@ -24,7 +29,7 @@ help:
2429
@echo " make build"
2530
@echo ""
2631

27-
@for target in $(ALL_TARGETS); do \
32+
@for target in $(ALL_BUILD_TARGETS); do \
2833
echo " $$target"; \
2934
done
3035

@@ -53,31 +58,31 @@ symlink-git-packages: build/symlink-git-packages.stamp
5358

5459
download-packages: build/download-packages.stamp
5560

56-
build: $(ALL_TARGETS)
61+
build: $(ALL_BUILD_TARGETS)
5762

58-
$(TARGETS): build-%:
59-
@$(MAKE) _build-$*
63+
$(SLIM_BUILD_TARGETS): build-%-slim:
64+
@BUILD_TYPE="slim" $(MAKE) _build-$*
6065

61-
$(PYTHON_TARGETS): build-with-python-%:
62-
@WITH_PYTHON="--with-python" $(MAKE) _build-$*
66+
$(FULL_BUILD_TARGETS): build-%-full:
67+
@BUILD_TYPE="full" GDB_BFD_ARCHS=$(GDB_BFD_ARCHS) $(MAKE) _build-$*
6368

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

7075
pack: $(ALL_PACK_TARGETS)
7176

72-
$(PACK_TARGETS): pack-%:
73-
@$(MAKE) _pack-$*
77+
$(SLIM_PACK_TARGETS): pack-%-slim:
78+
@BUILD_TYPE="slim" $(MAKE) _pack-$*
7479

75-
$(PYTHON_PACK_TARGETS): pack-with-python-%:
76-
@TAR_EXT="with-python-" ARTIFACT_EXT="_with_python" $(MAKE) _pack-$*
80+
$(FULL_PACK_TARGETS): pack-%-full:
81+
@BUILD_TYPE="full" $(MAKE) _pack-$*
7782

78-
_pack-%: build-%
79-
if [ ! -f "build/artifacts/gdb-static-$(TAR_EXT)$*.tar.gz" ]; then \
80-
tar -czf "build/artifacts/gdb-static-$(TAR_EXT)$*.tar.gz" -C "build/artifacts/$*$(ARTIFACT_EXT)" .; \
83+
_pack-%: build-%-$(BUILD_TYPE)
84+
if [ ! -f "build/artifacts/gdb-static-$(BUILD_TYPE)-$*.tar.gz" ]; then \
85+
tar -czf "build/artifacts/gdb-static-$(BUILD_TYPE)-$*.tar.gz" -C "build/artifacts/$*_$(BUILD_TYPE)" .; \
8186
fi
8287

8388
clean-git-packages:

README.md

+15-8
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,22 @@ This is where `gdb-static` comes in! We provide static builds of `gdb` (and `gdb
6060

6161
## Usage
6262

63-
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.
64-
65-
> [!NOTE]
66-
> We provide two types of builds:
67-
> 1. Builds with Python support, which are approximately ~30 MB in size.
68-
> 2. Slimmer builds without Python support, which are approximately ~7 MB in size.
63+
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 />
6964

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

67+
## Build types
68+
69+
We provide two types of builds:
70+
1. Slim builds, that contains most of the features, beside the ones mentioned below.
71+
2. Full builds that contains all of the slim build features, and also contains:
72+
* Python support
73+
* Cross-architecture debugging. <br />
74+
Note that in order to enable cross-architecture debugging, we have to disable the simulator feature, since not all targets have a simulator.
75+
76+
Slim builds are approximately ~10MB. Full builds are approximately ~70MB. <br />
77+
You can edit the full_build_conf.sh file to disable full build exclusive features.
78+
7279
## Development
7380

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

99106
```bash
100-
make build[-with-python]-<ARCH>
107+
make build-<ARCH>-[slim/full]
101108
```
102109

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

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

0 commit comments

Comments
 (0)