#
-# 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.
PKG_RELEASE:=1
PKG_MAINTAINER:=Felix Fietkau <nbd@openwrt.org>
+PKG_LICENSE:=GPL-3.0-with-GCC-exception
include $(INCLUDE_DIR)/package.mk
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)
"$(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/libatomic.so)" \
+ "$(wildcard $(TOOLCHAIN_DIR)/lib/libatomic.a)" \
+ "$(patsubst $(TOOLCHAIN_DIR)/lib/%,$(PKG_BUILD_DIR)/%,$(wildcard $(TOOLCHAIN_DIR)/lib/libatomic*.so))" \
+ $(BUILD_LIBGCC) \
+ -Wl,-soname=libatomic.so.0
$(SCRIPT_DIR)/relink-lib.sh \
"$(TARGET_CROSS)" \
"$(wildcard $(TOOLCHAIN_DIR)/lib/libm-*.so)" \
$(if $(CONFIG_TARGET_avr32)$(CONFIG_TARGET_coldfire),,$(CP) $(TOOLCHAIN_DIR)/lib/libgcc_s.so.* $(1)/lib/)
endef
+ define Package/libatomic/install
+ $(INSTALL_DIR) $(1)/lib
+ $(if $(CONFIG_GCC_VERSION_4_6)$(CONFIG_TARGET_avr32)$(CONFIG_TARGET_coldfire),,$(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/)
define Package/eglibc/install
$(CP) ./eglibc-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.* \
$(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
$(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/
exit 0
endef
+ define Package/libatomic/install
+ for file in $(call qstrip,$(CONFIG_LIBATOMIC_FILE_SPEC)); do \
+ dir=`dirname $$$$file` ; \
+ $(INSTALL_DIR) $(1)/$$$$dir ; \
+ $(CP) $(call qstrip,$(CONFIG_LIBATOMIC_ROOT_DIR))/$$$$file $(1)/$$$$dir/ ; \
+ done ; \
+ exit 0
+ endef
+
define Package/ldd/install
for file in $(call qstrip,$(CONFIG_LDD_FILE_SPEC)); do \
dir=`dirname $$$$file` ; \
$(eval $(call BuildPackage,libc))
$(eval $(call BuildPackage,libgcc))
+$(eval $(call BuildPackage,libatomic))
$(eval $(call BuildPackage,libssp))
$(eval $(call BuildPackage,libstdcpp))
$(eval $(call BuildPackage,libpthread))