1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110
|
#!/usr/bin/make -f
# export DH_VERBOSE=1
TARGET=arm-none-eabi
MULTILIB_LIST="--with-multilib-list=rmprofile"
GCC_PACKAGE=gcc-arm-none-eabi
SVERSION := $(shell dpkg-query -W -f="\$${Version}\n" $(GCC_PACKAGE)-source)
DVERSION := $(SVERSION)+$(shell dpkg-parsechangelog | sed -ne "s/^Version: \(.*\)/\1/p")
UVERSION := $(shell echo $(DVERSION) | cut -d- -f1)
BASE_VERSION := $(shell echo $(DVERSION) | sed -e 's/\([1-9]\.[0-9]\).*-.*/\1/')
BUILT_USING := $(shell dpkg-query -f '$${source:Package} (= $${source:Version}), ' -W $(GCC_PACKAGE)-source)
TOP_DIR=$(shell pwd)
LIBSTDCXX_SDIR=$(TOP_DIR)/src/libstdc++-v3
STAMP_DIR=$(TOP_DIR)/debian/stamp
UNPACK=$(STAMP_DIR)/unpack
APPY_PATCHES=$(STAMP_DIR)/patches
BUILD_DIR=$(TOP_DIR)/build/libstdc++
BUILD_NANO_DIR=$(TOP_DIR)/build_nano/libstdc++
PNEWLIB=libstdc\+\+-arm-none-eabi-newlib
BUILDFLAGS=CFLAGS="-g -O2 -ffunction-sections -fdata-sections" CXXFLAGS="-g -O2 -ffunction-sections -fdata-sections" LDFLAGS=""
BUILDFLAGS_NANO=CFLAGS="-g -Os -ffunction-sections -fdata-sections -fno-exceptions" CXXFLAGS="-g -Os -ffunction-sections -fdata-sections -fno-exceptions" LDFLAGS=""
TARGET_TOOLS=\
AR_FOR_TARGET=$(TARGET)-ar \
AS_FOR_TARGET=$(TARGET)-as \
LD_FOR_TARGET=$(TARGET)-ld \
NM_FOR_TARGET=$(TARGET)-nm \
OBJDUMP_FOR_TARGET=$(TARGET)-objdump \
RANLIB_FOR_TARGET=$(TARGET)-ranlib \
READELF_FOR_TARGET=$(TARGET)-readelf \
STRIP_FOR_TARGET=$(TARGET)-strip
CONFIGURE_FLAGS = \
--with-cross-host=$(DEB_HOST_GNU_TYPE) \
--enable-multilib \
--disable-decimal-float \
--disable-libffi \
--disable-libgomp \
--disable-libmudflap \
--disable-libquadmath \
--disable-libssp \
--disable-libstdcxx-pch \
--disable-nls \
--disable-shared \
--disable-threads \
--disable-tls \
--disable-plugin \
--disable-libstdcxx-verbose \
--mandir=/usr/share/man \
--with-system-zlib \
--with-gnu-as \
--with-gnu-ld \
--with-newlib \
--with-headers=yes \
"--with-pkgversion=$(DVERSION)" \
--without-included-gettext \
--with-host-libstdcxx="-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm" \
--enable-languages=c,c++ \
--disable-option-checking \
--build=$(DEB_BUILD_GNU_TYPE) \
--target=$(TARGET) \
--host=$(TARGET) \
$(MULTILIB_LIST) \
$(TARGET_TOOLS)
%:
dh $@ --parallel
$(UNPACK):
mkdir -p $(STAMP_DIR)
mkdir -p $(TOP_DIR)/src
tar xf /usr/src/gcc-arm-none-eabi-source.tar.* -C $(TOP_DIR)/src
touch $@
override_dh_auto_configure: $(UNPACK)
mkdir -p $(BUILD_DIR) $(BUILD_NANO_DIR)
dh_auto_configure -D$(LIBSTDCXX_SDIR) -B$(BUILD_DIR) -- $(CONFIGURE_FLAGS) $(BUILDFLAGS)
dh_auto_configure -D$(LIBSTDCXX_SDIR) -B$(BUILD_NANO_DIR) -- $(CONFIGURE_FLAGS) $(BUILDFLAGS_NANO)
override_dh_auto_clean:
rm -rf src build* debian/*tmp* $(STAMP_DIR)
override_dh_auto_test:
@echo "no testing, that's way too painful"
override_dh_gencontrol:
dh_gencontrol -- -v$(DVERSION) -Vlocal:Version=$(UVERSION) -Vgcc:Version=$(SVERSION) -VBuilt-Using="$(BUILT_USING)"
override_dh_auto_build:
dh_auto_build -B $(BUILD_DIR)
dh_auto_build -B $(BUILD_NANO_DIR)
override_dh_auto_install:
dh_auto_install -B $(BUILD_DIR) --destdir debian/$(PNEWLIB)-tmp
dh_auto_install -B $(BUILD_NANO_DIR) --destdir debian/$(PNEWLIB)-tmp_nano
find debian/$(PNEWLIB)-tmp_nano \
-name "*.a" \
-exec rename 's@debian/$(PNEWLIB)-tmp_nano/(.*).a@debian/$(PNEWLIB)-tmp/$$1_nano.a@' \{\} \;
find debian/$(PNEWLIB)-tmp -name "*.la" -exec rm -f {} +
override_dh_install:
dh_install --sourcedir debian/$(PNEWLIB)-tmp
override_dh_strip:
dh_strip -X.a
|