Debian Codegraph @

debian/rules

raw
1 #!/usr/bin/make -f
2
3 include /usr/share/dpkg/pkg-info.mk
4
5 MULTILIB_LIST_ARM="--with-multilib-list=rmprofile,aprofile"
6
7 PACKAGE_GCC_ARM=gcc-arm-none-eabi
8 PACKAGE_GCC_AARCH64=gcc-aarch64-none-elf
9 PACKAGE_GCC_SOURCE=gcc-arm-none-eabi-source
10 TARGET_ARM=arm-none-eabi
11 TARGET_AARCH64=aarch64-none-elf
12 TOP_DIR=$(shell pwd)
13 NPROC=$(shell nproc)
14
15 UPSTREAM_URL=https://developer.arm.com/-/media/Files/downloads/gnu/15.2.rel1/srcrel/arm-gnu-toolchain-src-snapshot-15.2.rel1.tar.xz
16 GCC_BUILD_DIR_ARM=$(TOP_DIR)/build-$(TARGET_ARM)
17 GCC_BUILD_DIR_AARCH64=$(TOP_DIR)/build-$(TARGET_AARCH64)
18 GCC_SOURCE_DIR=$(TOP_DIR)
19 GCC_DEB_TMP_DIR_ARM=$(TOP_DIR)/debian/$(PACKAGE_GCC_ARM)-tmp
20 GCC_DEB_TMP_DIR_AARCH64=$(TOP_DIR)/debian/$(PACKAGE_GCC_AARCH64)-tmp
21 GCC_SOURCE_DEB_TMP_DIR=$(TOP_DIR)/debian/$(PACKAGE_GCC_SOURCE)-tmp
22
23 export DEB_BUILD_MAINT_OPTIONS=hardening=-format
24 BUILDFLAGS:=$(shell dpkg-buildflags --export=configure) INHIBIT_LIBC_CFLAGS="-DUSE_TM_CLONE_REGISTRY=0"
25
26 TARGET_TOOLS_ARM=\
27 AR_FOR_TARGET=$(TARGET_ARM)-ar \
28 AS_FOR_TARGET=$(TARGET_ARM)-as \
29 LD_FOR_TARGET=$(TARGET_ARM)-ld \
30 NM_FOR_TARGET=$(TARGET_ARM)-nm \
31 OBJDUMP_FOR_TARGET=$(TARGET_ARM)-objdump \
32 RANLIB_FOR_TARGET=$(TARGET_ARM)-ranlib \
33 READELF_FOR_TARGET=$(TARGET_ARM)-readelf \
34 STRIP_FOR_TARGET=$(TARGET_ARM)-strip
35
36 TARGET_TOOLS_AARCH64=\
37 AR_FOR_TARGET=$(TARGET_AARCH64)-ar \
38 AS_FOR_TARGET=$(TARGET_AARCH64)-as \
39 LD_FOR_TARGET=$(TARGET_AARCH64)-ld \
40 NM_FOR_TARGET=$(TARGET_AARCH64)-nm \
41 OBJDUMP_FOR_TARGET=$(TARGET_AARCH64)-objdump \
42 RANLIB_FOR_TARGET=$(TARGET_AARCH64)-ranlib \
43 READELF_FOR_TARGET=$(TARGET_AARCH64)-readelf \
44 STRIP_FOR_TARGET=$(TARGET_AARCH64)-strip
45
46 CONFIGURE_GCC_FLAGS_LIBSTDC = \
47 --disable-libstdcxx
48
49 CONFIGURE_GCC_FLAGS_COMMON = \
50 --with-gcc-major-version-only \
51 --mandir=/usr/share/man \
52 --enable-languages=c,c++,lto \
53 --enable-multilib-space \
54 --disable-decimal-float \
55 --disable-libffi \
56 --disable-libgomp \
57 --disable-libmudflap \
58 --disable-libquadmath \
59 --disable-libssp \
60 --disable-libstdcxx-pch \
61 --disable-nls \
62 --disable-shared \
63 --disable-threads \
64 --enable-tls \
65 --build=$(DEB_BUILD_GNU_TYPE) \
66 --with-system-zlib \
67 --with-gnu-as \
68 --with-gnu-ld \
69 "--with-pkgversion=$(DEB_VERSION)" \
70 --without-included-gettext \
71 --prefix=/usr \
72 --libexecdir=/usr/libexec \
73 --libdir=/usr/lib \
74 --host=$(DEB_HOST_GNU_TYPE) \
75 --with-headers=no \
76 --with-picolibc \
77 --without-newlib \
78 $(CONFIGURE_GCC_FLAGS_LIBSTDC) \
79 $(BUILDFLAGS) \
80 SED=/bin/sed \
81 SHELL=/bin/sh \
82 BASH=/bin/bash \
83 CONFIG_SHELL=/bin/bash
84
85 CONFIGURE_GCC_FLAGS_ARM = \
86 $(CONFIGURE_GCC_FLAGS_COMMON) \
87 --target=$(TARGET_ARM) \
88 --enable-multilib \
89 --includedir=/usr/$(TARGET_ARM)/include \
90 --infodir=/usr/share/doc/$(PACKAGE_GCC_ARM)/info \
91 --htmldir=/usr/share/doc/$(PACKAGE_GCC_ARM)/html \
92 --pdfdir=/usr/share/doc/$(PACKAGE_GCC_ARM)/pdf \
93 $(MULTILIB_LIST_ARM) \
94 $(TARGET_TOOLS_ARM)
95
96 CONFIGURE_GCC_FLAGS_AARCH64 = \
97 $(CONFIGURE_GCC_FLAGS_COMMON) \
98 --target=$(TARGET_AARCH64) \
99 --disable-multilib \
100 --includedir=/usr/$(TARGET_AARCH64)/include \
101 --infodir=/usr/share/doc/$(PACKAGE_GCC_AARCH64)/info \
102 --htmldir=/usr/share/doc/$(PACKAGE_GCC_AARCH64)/html \
103 --pdfdir=/usr/share/doc/$(PACKAGE_GCC_AARCH64)/pdf \
104 $(TARGET_TOOLS_AARCH64)
105
106 %:
107 dh $@ --with autoreconf
108
109 override_dh_autoreconf:
110 autoreconf2.69 -f $(GCC_SOURCE_DIR)
111
112 override_dh_auto_configure:
113 dh_auto_configure -Bbuild-$(TARGET_AARCH64) -- $(CONFIGURE_GCC_FLAGS_AARCH64)
114 dh_auto_configure -Bbuild-$(TARGET_ARM) -- $(CONFIGURE_GCC_FLAGS_ARM)
115
116 override_dh_auto_build: build-aarch64 build-arm
117
118 build-aarch64:
119 dh_auto_build -Bbuild-$(TARGET_AARCH64) -- -j$(NPROC)
120
121 build-arm:
122 dh_auto_build -Bbuild-$(TARGET_ARM) -- -j$(NPROC)
123
124 override_dh_auto_install:
125 $(MAKE) install -C$(GCC_BUILD_DIR_ARM) DESTDIR=$(GCC_DEB_TMP_DIR_ARM)
126 $(MAKE) install -C$(GCC_BUILD_DIR_AARCH64) DESTDIR=$(GCC_DEB_TMP_DIR_AARCH64)
127
128 override_dh_auto_test:
129 @echo "no testing, that's way too painful"
130
131 override_dh_clean:
132 rm -rf build-$(TARGET_ARM)
133 rm -rf build-$(TARGET_AARCH64)
134 rm -rf $(GCC_BUILD_DIR_ARM)
135 rm -rf $(GCC_BUILD_DIR_AARCH64)
136 rm -rf $(GCC_DEB_TMP_DIR_ARM)
137 rm -rf $(GCC_DEB_TMP_DIR_ARM_AARCH64)
138 rm -rf $(GCC_SOURCE_DEB_TMP_DIR)
139 dh_clean
140
141 override_dh_strip:
142 dh_strip -X.a
143
144 override_dh_install:
145 dh_install -p$(PACKAGE_GCC_ARM) --sourcedir $(GCC_DEB_TMP_DIR_ARM)
146 dh_install -p$(PACKAGE_GCC_AARCH64) --sourcedir $(GCC_DEB_TMP_DIR_AARCH64)
147 mkdir -p $(GCC_SOURCE_DEB_TMP_DIR)/usr/src
148 tar --exclude=build-$(TARGET_ARM) --exclude=build-$(TARGET_AARCH64) --exclude=.git --exclude=debian --exclude=autom4te.cache --sort=name --mtime="@$(SOURCE_DATE_EPOCH)" --owner=0 --group=0 --numeric-owner --mode=go-w,u+rw -C $(TOP_DIR) -c -f - . | xz -T0 > $(GCC_SOURCE_DEB_TMP_DIR)/usr/src/$(PACKAGE_GCC_SOURCE).tar.xz
149 dh_install -p$(PACKAGE_GCC_SOURCE) --sourcedir $(GCC_SOURCE_DEB_TMP_DIR)
150
151 override_dh_compress:
152 dh_compress -Xexamples/