musl: fix mips vdso handling
[openwrt/staging/chunkeey.git] / toolchain / musl / Makefile
index 79ea175..1533f51 100644 (file)
@@ -7,6 +7,10 @@ HOST_STAMP_INSTALLED:=$(TOOLCHAIN_DIR)/stamp/.musl_installed
 
 HOST_BUILD_PARALLEL:=1
 
+MUSL_MAKEOPTS = -C $(HOST_BUILD_DIR) \
+       DESTDIR="$(TOOLCHAIN_DIR)/" \
+       LIBCC="$(subst libgcc.a,libgcc_initial.a,$(shell $(TARGET_CC) -print-libgcc-file-name))"
+
 define Host/SetToolchainInfo
        $(SED) 's,^\(LIBC_TYPE\)=.*,\1=$(PKG_NAME),' $(TOOLCHAIN_DIR)/info.mk
        $(SED) 's,^\(LIBC_URL\)=.*,\1=http://www.musl-libc.org/,' $(TOOLCHAIN_DIR)/info.mk
@@ -15,24 +19,13 @@ define Host/SetToolchainInfo
 endef
 
 define Host/Compile
-       $(MAKE) $(HOST_JOBS) -C $(HOST_BUILD_DIR) all
+       +$(MAKE) $(HOST_JOBS) $(MUSL_MAKEOPTS) all
 endef
 
 define Host/Install
        $(call Host/SetToolchainInfo)
-       $(MAKE) -C $(HOST_BUILD_DIR) DESTDIR="$(TOOLCHAIN_DIR)/" install
-       ( cd $(TOOLCHAIN_DIR) ; \
-               for d in lib usr/lib ; do \
-                 for f in libc.so libpthread.so libgcc_s.so ; do \
-                   if [ -f $$$$d/$$$$f -a ! -L $$$$d/$$$$f ] ; then \
-                     $(SED) 's,/usr/lib/,,g;s,/lib/,,g' $$$$d/$$$$f ; \
-                   fi \
-                 done \
-               done \
-       )
-       rm -f \
-               $(TOOLCHAIN_DIR)/lib/libresolv*.so* \
-               $(TOOLCHAIN_DIR)/lib/libnsl*.so*
+       $(MAKE) $(MUSL_MAKEOPTS) DESTDIR="$(TOOLCHAIN_DIR)/" install
+       $(CP) ./include $(TOOLCHAIN_DIR)/
 endef
 
 $(eval $(call HostBuild))