X-Git-Url: http://git.openwrt.org/?p=openwrt%2Fopenwrt.git;a=blobdiff_plain;f=package%2Flibs%2Ftoolchain%2FMakefile;h=0101b81a318b51680d6078ca703f492fa1a76093;hp=e4a78ed5f2d48a19061a9f04eba7010fa27da494;hb=493b0f3f575520b35b6b01341b28147c67e90884;hpb=4255b2fde576ee47ac75a71d6fc3f1fed04fb596 diff --git a/package/libs/toolchain/Makefile b/package/libs/toolchain/Makefile index e4a78ed5f2..0101b81a31 100644 --- a/package/libs/toolchain/Makefile +++ b/package/libs/toolchain/Makefile @@ -1,5 +1,5 @@ # -# Copyright (C) 2007-2012 OpenWrt.org +# Copyright (C) 2007-2014 OpenWrt.org # # This is free software, licensed under the GNU General Public License v2. # See /LICENSE for more information. @@ -9,7 +9,10 @@ include $(TOPDIR)/rules.mk PKG_NAME:=toolchain PKG_RELEASE:=1 -PKG_MAINTAINER:=Felix Fietkau +PKG_MAINTAINER:=Felix Fietkau +PKG_LICENSE:=GPL-3.0-with-GCC-exception + +PKG_FLAGS:=hold essential nonshared include $(INCLUDE_DIR)/package.mk @@ -52,6 +55,31 @@ define Package/libgcc/config endmenu endef +define Package/libatomic +$(call Package/gcc/Default) + DEPENDS:=+libgcc + TITLE:=Atomic support library +endef + +define Package/libatomic/config + menu "Configuration" + depends on EXTERNAL_TOOLCHAIN && PACKAGE_libatomic + + config LIBATOMIC_ROOT_DIR + string + prompt "libatomic shared library base directory" + depends on EXTERNAL_TOOLCHAIN && PACKAGE_libatomic + default TOOLCHAIN_ROOT if !NATIVE_TOOLCHAIN + default "/" if NATIVE_TOOLCHAIN + + config LIBATOMIC_FILE_SPEC + string + prompt "libatomic shared library files (use wildcards)" + depends on EXTERNAL_TOOLCHAIN && PACKAGE_libatomic + default "./lib/libatomic.so.*" + + endmenu +endef define Package/libssp $(call Package/gcc/Default) @@ -113,7 +141,6 @@ define Package/libc/Default VERSION:=$(LIBC_VERSION)-$(PKG_RELEASE) DEPENDS:=+libgcc URL:=$(LIBC_URL) - PKG_FLAGS:=hold essential endef @@ -292,66 +319,19 @@ endef LIBGCC_A=$(lastword $(wildcard $(TOOLCHAIN_DIR)/lib/gcc/*/*/libgcc_pic.a)) LIBGCC_MAP=$(lastword $(wildcard $(TOOLCHAIN_DIR)/lib/gcc/*/*/libgcc.map)) LIBGCC_SO=$(lastword $(wildcard $(TOOLCHAIN_DIR)/lib/libgcc_s.so.*)) -ifeq ($(CONFIG_EXTERNAL_TOOLCHAIN),) - ifneq ($(if $(CONFIG_USE_UCLIBC),$(CONFIG_GCC_VERSION_LINARO)),) - BUILD_LIBGCC:=$(if $(CONFIG_avr32)$(CONFIG_m68k)$(CONFIG_powerpc),,$(PKG_BUILD_DIR)/libgcc_s.so.*) - endif -endif -ifneq ($(BUILD_LIBGCC),) - define Build/Compile/uClibc - $(SCRIPT_DIR)/relink-lib.sh \ - "$(TARGET_CROSS)" \ - "$(wildcard $(TOOLCHAIN_DIR)/lib/libc_so.a)" \ - "$(wildcard $(TOOLCHAIN_DIR)/lib/libc_so.a)" \ - "$(patsubst $(TOOLCHAIN_DIR)/lib/%,$(PKG_BUILD_DIR)/%,$(wildcard $(TOOLCHAIN_DIR)/lib/libuClibc-*.so))" \ - -Wl,-init,__uClibc_init -Wl,-soname=libc.so.0 \ - $(BUILD_LIBGCC) - $(SCRIPT_DIR)/relink-lib.sh \ - "$(TARGET_CROSS)" \ - "$(wildcard $(TOOLCHAIN_DIR)/lib/libcrypt-*.so)" \ - "$(wildcard $(TOOLCHAIN_DIR)/lib/libcrypt_pic.a)" \ - "$(patsubst $(TOOLCHAIN_DIR)/lib/%,$(PKG_BUILD_DIR)/%,$(wildcard $(TOOLCHAIN_DIR)/lib/libcrypt-*.so))" \ - $(BUILD_LIBGCC) \ - -Wl,-soname=libcrypt.so.0 - $(SCRIPT_DIR)/relink-lib.sh \ - "$(TARGET_CROSS)" \ - "$(wildcard $(TOOLCHAIN_DIR)/lib/libm-*.so)" \ - "$(wildcard $(TOOLCHAIN_DIR)/lib/libm_pic.a)" \ - "$(patsubst $(TOOLCHAIN_DIR)/lib/%,$(PKG_BUILD_DIR)/%,$(wildcard $(TOOLCHAIN_DIR)/lib/libm-*.so))" \ - $(BUILD_LIBGCC) \ - -Wl,-soname=libm.so.0 - $(SCRIPT_DIR)/relink-lib.sh \ - "$(TARGET_CROSS)" \ - "$(wildcard $(TOOLCHAIN_DIR)/lib/libpthread-*.so)" \ - "$(wildcard $(TOOLCHAIN_DIR)/lib/libpthread_so.a)" \ - "$(patsubst $(TOOLCHAIN_DIR)/lib/%,$(PKG_BUILD_DIR)/%,$(wildcard $(TOOLCHAIN_DIR)/lib/libpthread-*.so))" \ - -Wl,-z,nodelete,-z,initfirst,-init=__pthread_initialize_minimal_internal \ - -ldl -lc $(BUILD_LIBGCC) \ - -Wl,-soname=libpthread.so.0 - endef - define Build/Compile/libgcc - $(SCRIPT_DIR)/relink-lib.sh \ - "$(TARGET_CROSS)" \ - "$(LIBGCC_SO)" \ - "$(LIBGCC_A)" \ - "$(patsubst $(TOOLCHAIN_DIR)/lib/%,$(PKG_BUILD_DIR)/%,$(LIBGCC_SO))" \ - -Wl,--version-script=$(LIBGCC_MAP) -Wl,-soname=libgcc_s.so.1 - endef -else - define Build/Compile/uClibc +define Build/Compile/uClibc $(CP) \ $(TOOLCHAIN_DIR)/lib/libuClibc-*.so \ $(TOOLCHAIN_DIR)/lib/libcrypt-*.so \ $(TOOLCHAIN_DIR)/lib/libm-*.so \ $(TOOLCHAIN_DIR)/lib/libpthread-*.so \ $(PKG_BUILD_DIR)/ - endef - ifneq ($(LIBGCC_SO),) +endef +ifneq ($(LIBGCC_SO),) define Build/Compile/libgcc $(CP) $(LIBGCC_SO) $(PKG_BUILD_DIR)/ endef - endif endif define Build/Compile/Default @@ -364,12 +344,17 @@ ifeq ($(CONFIG_EXTERNAL_TOOLCHAIN),) define Package/libgcc/install $(INSTALL_DIR) $(1)/lib - $(if $(CONFIG_TARGET_avr32)$(CONFIG_TARGET_coldfire),,$(CP) $(TOOLCHAIN_DIR)/lib/libgcc_s.so.* $(1)/lib/) + $(CP) $(TOOLCHAIN_DIR)/lib/libgcc_s.so.* $(1)/lib/ + endef + + define Package/libatomic/install + $(INSTALL_DIR) $(1)/lib + $(CP) $(TOOLCHAIN_DIR)/lib/libatomic.so.* $(1)/lib/ endef define Package/libgfortran/install $(INSTALL_DIR) $(1)/usr/lib - $(if $(CONFIG_TARGET_avr32)$(CONFIG_TARGET_coldfire),,$(CP) $(TOOLCHAIN_DIR)/lib/libgfortran.so.* $(1)/usr/lib/) + $(CP) $(TOOLCHAIN_DIR)/lib/libgfortran.so.* $(1)/usr/lib/ endef define Package/libssp/install @@ -382,20 +367,16 @@ ifeq ($(CONFIG_EXTERNAL_TOOLCHAIN),) $(CP) $(TOOLCHAIN_DIR)/lib/libstdc++.so.* $(1)/usr/lib/ endef - use_libutil=$(if $(CONFIG_EGLIBC_OPTION_EGLIBC_UTMP),libutil) - use_libnsl=$(if $(CONFIG_EGLIBC_OPTION_EGLIBC_NIS),libnsl) - use_nsswitch=$(if $(CONFIG_EGLIBC_OPTION_EGLIBC_NSSWITCH),libnss_dns libnss_files) - - define Package/eglibc/install - $(CP) ./eglibc-files/* $(1)/ + define Package/glibc/install + $(CP) ./glibc-files/* $(1)/ rm -f $(1)/etc/localtime - ln -sf /tmp/localtime $(1)/etc/localtime + $(LN) /tmp/localtime $(1)/etc/localtime $(INSTALL_DIR) $(1)/lib $(CP) \ $(TOOLCHAIN_DIR)/lib/ld*.so.* \ $(TOOLCHAIN_DIR)/lib/ld-$(LIBC_SO_VERSION).so \ $(1)/lib/ - for file in libanl libc libcidn libcrypt libdl libm $(use_libnsl) $(use_nsswitch) libresolv $(use_libutil); do \ + for file in libanl libc libcidn libcrypt libdl libm libnsl libnss_dns libnss_files libresolv libutil; do \ for file in $(TOOLCHAIN_DIR)/lib/$$$$file.so.* $(TOOLCHAIN_DIR)/lib/$$$$file-$(LIBC_SO_VERSION).so; do \ if [ -e "$$$$file" ]; then \ $(CP) $$$$file $(1)/lib/; \ @@ -428,17 +409,17 @@ ifeq ($(CONFIG_EXTERNAL_TOOLCHAIN),) $(1)/lib/ endef - LD_MUSL_NAME = $(notdir $(firstword $(wildcard $(TOOLCHAIN_DIR)/lib/ld-musl-*.so*))) + LD_MUSL_NAME = $(notdir $(firstword $(wildcard $(TOOLCHAIN_DIR)/lib/libc.so*))) define Package/musl/install - $(INSTALL_DIR) $(1)/lib + $(INSTALL_DIR) $(1)/lib $(1)/usr/bin $(CP) \ $(TOOLCHAIN_DIR)/lib/ld-musl-*.so* \ $(1)/lib/ $(CP) \ $(TOOLCHAIN_DIR)/lib/libc.so* \ $(1)/lib/ - $(if $(findstring -sf.so,$(LD_MUSL_NAME)),ln -s $(LD_MUSL_NAME) $(1)/lib/$(subst -sf.so,.so,$(LD_MUSL_NAME))) + $(LN) ../../lib/$(LD_MUSL_NAME) $(1)/usr/bin/ldd endef define Package/libc/install @@ -459,10 +440,7 @@ ifeq ($(CONFIG_EXTERNAL_TOOLCHAIN),) ifneq ($(CONFIG_USE_MUSL),y) $(CP) \ $(TOOLCHAIN_DIR)/lib/libpthread.so.* \ - $(if $(BUILD_LIBGCC),\ - $(PKG_BUILD_DIR)/libpthread-$(LIBC_SO_VERSION).so, \ - $(TOOLCHAIN_DIR)/lib/libpthread-$(LIBC_SO_VERSION).so \ - ) \ + $(TOOLCHAIN_DIR)/lib/libpthread-$(LIBC_SO_VERSION).so \ $(1)/lib/ endif endef @@ -471,7 +449,7 @@ ifeq ($(CONFIG_EXTERNAL_TOOLCHAIN),) $(INSTALL_DIR) $(1)/lib $(CP) \ $(TOOLCHAIN_DIR)/lib/libthread_db.so.* $(1)/lib - ifeq ($(USE_UCLIBC),y) + ifeq ($(CONFIG_USE_UCLIBC),y) $(CP) \ $(TOOLCHAIN_DIR)/lib/libthread_db-$(LIBC_SO_VERSION).so \ $(1)/lib/ @@ -506,62 +484,63 @@ else define Package/libgcc/install for file in $(call qstrip,$(CONFIG_LIBGCC_FILE_SPEC)); do \ - dir=`dirname $$$$file` ; \ - $(INSTALL_DIR) $(1)/$$$$dir ; \ - $(CP) $(call qstrip,$(CONFIG_LIBGCC_ROOT_DIR))/$$$$file $(1)/$$$$dir/ ; \ + $(INSTALL_DIR) $(1)/lib ; \ + $(CP) $(call qstrip,$(CONFIG_LIBGCC_ROOT_DIR))/$$$$file $(1)/lib/ ; \ done ; \ exit 0 endef define Package/libgfortran/install for file in $(call qstrip,$(CONFIG_LIBGFORTRAN_FILE_SPEC)); do \ - dir=`dirname $$$$file` ; \ - $(INSTALL_DIR) $(1)/$$$$dir ; \ - $(CP) $(call qstrip,$(CONFIG_LIBGFORTRAN_ROOT_DIR))/$$$$file $(1)/$$$$dir/ ; \ + $(INSTALL_DIR) $(1)/lib ; \ + $(CP) $(call qstrip,$(CONFIG_LIBGFORTRAN_ROOT_DIR))/$$$$file $(1)/lib/ ; \ done endef define Package/libssp/install for file in $(call qstrip,$(CONFIG_LIBSSP_FILE_SPEC)); do \ - dir=`dirname $$$$file` ; \ - $(INSTALL_DIR) $(1)/$$$$dir ; \ - $(CP) $(call qstrip,$(CONFIG_LIBSSP_ROOT_DIR))/$$$$file $(1)/$$$$dir/ ; \ + $(INSTALL_DIR) $(1)/lib ; \ + $(CP) $(call qstrip,$(CONFIG_LIBSSP_ROOT_DIR))/$$$$file $(1)/lib/ ; \ done ; \ exit 0 endef define Package/libstdcpp/install for file in $(call qstrip,$(CONFIG_LIBSTDCPP_FILE_SPEC)); do \ - dir=`dirname $$$$file` ; \ - $(INSTALL_DIR) $(1)/$$$$dir ; \ - $(CP) $(call qstrip,$(CONFIG_LIBSTDCPP_ROOT_DIR))/$$$$file $(1)/$$$$dir/ ; \ + $(INSTALL_DIR) $(1)/lib ; \ + $(CP) $(call qstrip,$(CONFIG_LIBSTDCPP_ROOT_DIR))/$$$$file $(1)/lib/ ; \ done ; \ exit 0 endef define Package/libc/install for file in $(call qstrip,$(CONFIG_LIBC_FILE_SPEC)); do \ - dir=`dirname $$$$file` ; \ - $(INSTALL_DIR) $(1)/$$$$dir ; \ - $(CP) $(call qstrip,$(CONFIG_LIBC_ROOT_DIR))/$$$$file $(1)/$$$$dir/ ; \ + $(INSTALL_DIR) $(1)/lib ; \ + $(CP) $(call qstrip,$(CONFIG_LIBC_ROOT_DIR))/$$$$file $(1)/lib/ ; \ done ; \ exit 0 endef define Package/libpthread/install for file in $(call qstrip,$(CONFIG_LIBPTHREAD_FILE_SPEC)); do \ - dir=`dirname $$$$file` ; \ - $(INSTALL_DIR) $(1)/$$$$dir ; \ - $(CP) $(call qstrip,$(CONFIG_LIBPTHREAD_ROOT_DIR))/$$$$file $(1)/$$$$dir/ ; \ + $(INSTALL_DIR) $(1)/lib ; \ + $(CP) $(call qstrip,$(CONFIG_LIBPTHREAD_ROOT_DIR))/$$$$file $(1)/lib/ ; \ done ; \ exit 0 endef define Package/librt/install for file in $(call qstrip,$(CONFIG_LIBRT_FILE_SPEC)); do \ - dir=`dirname $$$$file` ; \ - $(INSTALL_DIR) $(1)/$$$$dir ; \ - $(CP) $(call qstrip,$(CONFIG_LIBRT_ROOT_DIR))/$$$$file $(1)/$$$$dir/ ; \ + $(INSTALL_DIR) $(1)/lib ; \ + $(CP) $(call qstrip,$(CONFIG_LIBRT_ROOT_DIR))/$$$$file $(1)/lib/ ; \ + done ; \ + exit 0 + endef + + define Package/libatomic/install + for file in $(call qstrip,$(CONFIG_LIBATOMIC_FILE_SPEC)); do \ + $(INSTALL_DIR) $(1)/lib ; \ + $(CP) $(call qstrip,$(CONFIG_LIBATOMIC_ROOT_DIR))/$$$$file $(1)/lib/ ; \ done ; \ exit 0 endef @@ -588,6 +567,7 @@ endif $(eval $(call BuildPackage,libc)) $(eval $(call BuildPackage,libgcc)) +$(eval $(call BuildPackage,libatomic)) $(eval $(call BuildPackage,libssp)) $(eval $(call BuildPackage,libstdcpp)) $(eval $(call BuildPackage,libpthread))