[package/binutils]: handle the Linaro version as well
[15.05/openwrt.git] / package / devel / binutils / Makefile
1 #
2 # Copyright (C) 2006-2013 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7
8 include $(TOPDIR)/rules.mk
9
10 PKG_NAME:=binutils
11 PKG_VERSION:=$(strip $(subst ",, $(CONFIG_BINUTILS_VERSION)))
12 #"))
13 PKG_RELEASE:=6
14
15 ifeq ($(findstring linaro, $(CONFIG_BINUTILS_VERSION)),linaro)
16   PKG_SOURCE_URL:=https://releases.linaro.org/13.06/components/toolchain/binutils-linaro/
17   PKG_REV:=2.23.2-2013.06
18   PKG_SOURCE:=$(PKG_NAME)-linaro-$(PKG_REV).tar.bz2
19   BINUTILS_DIR:=$(PKG_NAME)-2.23.2
20   PKG_BUILD_DIR:=$(BUILD_DIR_TOOLCHAIN)/$(BINUTILS_DIR)
21   PKG_VERSION:=$(PKG_REV)
22 else
23   PKG_SOURCE_URL:=@GNU/binutils
24   PKG_SOURCE:=binutils-$(PKG_VERSION).tar.bz2
25 endif
26 PKG_MD5SUM:=
27
28 PATCH_DIR:=$(TOPDIR)/toolchain/binutils/patches/$(PKG_VERSION)
29
30 PKG_FIXUP:=autoreconf
31 PKG_LIBTOOL_PATHS:=. gas bfd opcodes gprof binutils ld libiberty gold intl
32 PKG_REMOVE_FILES:=libtool.m4
33 PKG_INSTALL:=1
34
35 PKG_MAINTAINER:=Felix Fietkau <nbd@openwrt.org>
36
37 PKG_BUILD_PARALLEL:=1
38
39 include $(INCLUDE_DIR)/package.mk
40
41 define Package/binutils
42   SECTION:=devel
43   CATEGORY:=Development
44   TITLE:=binutils
45   DEPENDS:=+objdump
46 endef
47
48 define Package/objdump
49   SECTION:=devel
50   CATEGORY:=Development
51   TITLE:=objdump
52   DEPENDS:=+zlib 
53 endef
54
55 define Package/binutils/description
56   The Binutils package contains a linker, an assembler, and other tools for handling object files
57 endef
58
59 CONFIGURE_ARGS = \
60                 --target=$(REAL_GNU_TARGET_NAME) \
61                 --host=$(REAL_GNU_TARGET_NAME) \
62                 --build=$(GNU_HOST_NAME) \
63                 --prefix=/usr \
64                 --disable-multilib \
65                 --disable-werror \
66                 --disable-nls \
67                 --enable-shared \
68                 $(SOFT_FLOAT_CONFIG_OPTION) \
69                 $(call qstrip,$(CONFIG_EXTRA_BINUTILS_CONFIG_OPTIONS))
70
71 TARGET_CFLAGS += $(FPIC)
72 TARGET_LDFLAGS := -L$(PKG_BUILD_DIR)/libiberty $(TARGET_LDFLAGS)
73
74 define Build/Configure
75         $(call Build/Configure/Default)
76         $(call Build/Compile/Default, \
77                 configure-bfd \
78                 configure-binutils \
79                 configure-etc \
80                 configure-gas \
81                 configure-gprof \
82                 configure-intl \
83                 configure-ld \
84                 configure-libiberty \
85                 configure-opcodes \
86         )
87         $(MAKE) CFLAGS="$(TARGET_CFLAGS)" -C $(PKG_BUILD_DIR)/bfd/po Makefile
88 endef
89
90 define Build/InstallDev
91         $(INSTALL_DIR) $(1)/usr/{lib,include}
92         $(CP) \
93                 $(PKG_INSTALL_DIR)/usr/lib/* \
94                 $(1)/usr/lib/
95         $(CP) \
96                 $(PKG_BUILD_DIR)/include/*.h \
97                 $(1)/usr/include/
98         $(CP) \
99                 $(PKG_INSTALL_DIR)/usr/include/* \
100                 $(1)/usr/include/
101         rm -f $(1)/usr/include/gdbm.h
102 endef
103
104 define Build/Compile
105         +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR)/bfd/doc/ CFLAGS="-I$(PKG_BUILD_DIR)/include" chew
106         $(call Build/Compile/Default)
107 endef
108
109 define Package/objdump/install
110         $(INSTALL_DIR) $(1)/usr/bin $(1)/usr/lib
111         $(CP) $(PKG_INSTALL_DIR)/usr/bin/objdump $(1)/usr/bin/
112         $(CP) $(PKG_INSTALL_DIR)/usr/lib/libopcodes*.so $(1)/usr/lib/
113         $(CP) $(PKG_INSTALL_DIR)/usr/lib/libbfd*.so $(1)/usr/lib/
114 endef
115
116 define Package/binutils/install
117         $(INSTALL_DIR) $(1)/usr $(1)/bin
118         $(CP) $(PKG_INSTALL_DIR)/usr/bin/ $(1)/usr/
119         mv $(1)/usr/bin/strings $(1)/bin/strings
120         rm -f $(1)/usr/bin/objdump
121 endef
122
123 $(eval $(call BuildPackage,binutils))
124 $(eval $(call BuildPackage,objdump))