toolchain: Allow external toolchains to specify libthread-db
[openwrt/openwrt.git] / package / libs / toolchain / Makefile
index 75a3f3553995e9d067902a508ad9173f59f8183b..8a90b5eda665803218bc0e1c1db9020bdf2855ce 100644 (file)
@@ -164,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.*}"
 
        endmenu
 endef
@@ -202,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
@@ -323,9 +343,6 @@ LIBGCC_SO=$(lastword $(wildcard $(TOOLCHAIN_DIR)/lib/libgcc_s.so.*))
 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),)
@@ -395,17 +412,8 @@ ifeq ($(CONFIG_EXTERNAL_TOOLCHAIN),)
                $(TOOLCHAIN_DIR)/lib/libc.so.* \
                $(TOOLCHAIN_DIR)/lib/libuClibc-$(LIBC_SO_VERSION).so \
                $(1)/lib/
-       for file in libcrypt libdl libm libutil; do \
-               $(CP) \
-                       $(TOOLCHAIN_DIR)/lib/$$$$file.so.* \
-                       $(TOOLCHAIN_DIR)/lib/$$$$file-$(LIBC_SO_VERSION).so \
-                       $(1)/lib/; \
-       done
-
        $(CP) \
                $(PKG_BUILD_DIR)/libuClibc-* \
-               $(PKG_BUILD_DIR)/libm-* \
-               $(PKG_BUILD_DIR)/libcrypt-* \
                $(1)/lib/
   endef
 
@@ -437,7 +445,7 @@ ifeq ($(CONFIG_EXTERNAL_TOOLCHAIN),)
 
   define Package/libpthread/install
        $(INSTALL_DIR) $(1)/lib
-  ifneq ($(CONFIG_USE_MUSL),y)
+  ifneq ($(CONFIG_USE_MUSL)$(CONFIG_USE_UCLIBC),y)
        $(CP) \
                $(TOOLCHAIN_DIR)/lib/libpthread.so.* \
                $(TOOLCHAIN_DIR)/lib/libpthread-$(LIBC_SO_VERSION).so \
@@ -462,7 +470,7 @@ ifeq ($(CONFIG_EXTERNAL_TOOLCHAIN),)
 
   define Package/librt/install
        $(INSTALL_DIR) $(1)/lib
-  ifneq ($(CONFIG_USE_MUSL),y)
+  ifneq ($(CONFIG_USE_MUSL)$(CONFIG_USE_UCLIBC),y)
        $(CP) \
                $(TOOLCHAIN_DIR)/lib/librt.so.* \
                $(TOOLCHAIN_DIR)/lib/librt-$(LIBC_SO_VERSION).so \
@@ -484,71 +492,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