toolchain: add musl libc.so to external toolchain
[openwrt/openwrt.git] / package / libs / toolchain / Makefile
index 734e68dc70e15b063b08cb5aceb751fc369343d1..58bd06cb5aba92f8d42f293ee978bddee90de215 100644 (file)
@@ -9,9 +9,11 @@ include $(TOPDIR)/rules.mk
 PKG_NAME:=toolchain
 PKG_RELEASE:=1
 
-PKG_MAINTAINER:=Felix Fietkau <nbd@openwrt.org>
+PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
 PKG_LICENSE:=GPL-3.0-with-GCC-exception
 
+PKG_FLAGS:=hold essential nonshared
+
 include $(INCLUDE_DIR)/package.mk
 
 ifneq ($(DUMP),1)
@@ -139,7 +141,6 @@ define Package/libc/Default
   VERSION:=$(LIBC_VERSION)-$(PKG_RELEASE)
   DEPENDS:=+libgcc
   URL:=$(LIBC_URL)
-  PKG_FLAGS:=hold essential
 endef
 
 
@@ -163,7 +164,7 @@ define Package/libc/config
                string
                prompt "libc shared library files (use wildcards)"
                depends on EXTERNAL_TOOLCHAIN && PACKAGE_libc
-               default "./lib/ld{-*.so,-linux*.so.*} ./lib/lib{anl,c,cidn,crypt,dl,m,nsl,nss_dns,nss_files,resolv,util}{-*.so,.so.*}"
+               default "./lib/ld{*.so*,-linux*.so.*} ./lib/lib{anl,c,cidn,crypt,dl,m,nsl,nss_dns,nss_files,resolv,util}{-*.so,.so.*,.so}"
 
        endmenu
 endef
@@ -201,6 +202,26 @@ $(call Package/libc/Default)
   TITLE:=POSIX thread library debugging support
 endef
 
+define Package/libthread-db/config
+       menu "Configuration"
+       depends on EXTERNAL_TOOLCHAIN && PACKAGE_libthread-db
+
+       config LIBTHREAD_DB_ROOT_DIR
+               string
+               prompt "POSIX thread debugging shared library base directory"
+               depends on EXTERNAL_TOOLCHAIN && PACKAGE_libthread-db
+               default TOOLCHAIN_ROOT  if !NATIVE_TOOLCHAIN
+               default "/"  if NATIVE_TOOLCHAIN
+
+       config LIBTHREAD_DB_FILE_SPEC
+               string
+               prompt "POSIX thread debugging shared library files (use wildcards)"
+               depends on EXTERNAL_TOOLCHAIN && PACKAGE_libthread-db
+               default "./lib/libthread_db{-*.so,.so.*}"
+
+       endmenu
+endef
+
 define Package/librt
 $(call Package/libc/Default)
   TITLE:=POSIX.1b RealTime extension library
@@ -366,10 +387,6 @@ ifeq ($(CONFIG_EXTERNAL_TOOLCHAIN),)
        $(CP) $(TOOLCHAIN_DIR)/lib/libstdc++.so.* $(1)/usr/lib/
   endef
 
-  use_libutil=$(if $(CONFIG_GLIBC_USE_VERSION_2_21)$(CONFIG_EGLIBC_OPTION_EGLIBC_UTMP),libutil)
-  use_libnsl=$(if $(CONFIG_GLIBC_USE_VERSION_2_21)$(CONFIG_EGLIBC_OPTION_EGLIBC_NIS),libnsl)
-  use_nsswitch=$(if $(CONFIG_GLIBC_USE_VERSION_2_21)$(CONFIG_EGLIBC_OPTION_EGLIBC_NSSWITCH),libnss_dns libnss_files)
-
   define Package/glibc/install
        $(CP) ./glibc-files/* $(1)/
        rm -f $(1)/etc/localtime
@@ -379,7 +396,7 @@ ifeq ($(CONFIG_EXTERNAL_TOOLCHAIN),)
                $(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/; \
@@ -487,71 +504,71 @@ 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/libthread-db/install
+       for file in $(call qstrip,$(CONFIG_LIBTHREAD_DB_FILE_SPEC)); do \
+               $(INSTALL_DIR) $(1)/lib ; \
+               $(CP) $(call qstrip,$(CONFIG_LIBTHREAD_DB_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 \
-               dir=`dirname $$$$file` ; \
-               $(INSTALL_DIR) $(1)/$$$$dir ; \
-               $(CP) $(call qstrip,$(CONFIG_LIBATOMIC_ROOT_DIR))/$$$$file $(1)/$$$$dir/ ; \
+               $(INSTALL_DIR) $(1)/lib ; \
+               $(CP) $(call qstrip,$(CONFIG_LIBATOMIC_ROOT_DIR))/$$$$file $(1)/lib/ ; \
        done ; \
        exit 0
   endef