Makefile 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646
  1. #
  2. # Copyright (C) 2007-2014 OpenWrt.org
  3. #
  4. # This is free software, licensed under the GNU General Public License v2.
  5. # See /LICENSE for more information.
  6. #
  7. include $(TOPDIR)/rules.mk
  8. PKG_NAME:=toolchain
  9. PKG_RELEASE:=1
  10. PKG_MAINTAINER:=Felix Fietkau <nbd@openwrt.org>
  11. PKG_LICENSE:=GPL-3.0-with-GCC-exception
  12. include $(INCLUDE_DIR)/package.mk
  13. ifneq ($(DUMP),1)
  14. LIBGCC_VERSION:=$(GCC_VERSION)
  15. else
  16. LIBC_VERSION:=<LIBC_VERSION>
  17. LIBGCC_VERSION:=<LIBGCC_VERSION>
  18. endif
  19. define Package/gcc/Default
  20. SECTION:=libs
  21. CATEGORY:=Base system
  22. URL:=http://gcc.gnu.org/
  23. VERSION:=$(LIBGCC_VERSION)-$(PKG_RELEASE)
  24. endef
  25. define Package/libgcc
  26. $(call Package/gcc/Default)
  27. TITLE:=GCC support library
  28. endef
  29. define Package/libgcc/config
  30. menu "Configuration"
  31. depends on EXTERNAL_TOOLCHAIN && PACKAGE_libgcc
  32. config LIBGCC_ROOT_DIR
  33. string
  34. prompt "libgcc shared library base directory"
  35. depends on EXTERNAL_TOOLCHAIN && PACKAGE_libgcc
  36. default TOOLCHAIN_ROOT if !NATIVE_TOOLCHAIN
  37. default "/" if NATIVE_TOOLCHAIN
  38. config LIBGCC_FILE_SPEC
  39. string
  40. prompt "libgcc shared library files (use wildcards)"
  41. depends on EXTERNAL_TOOLCHAIN && PACKAGE_libgcc
  42. default "./lib/libgcc_s.so.*"
  43. endmenu
  44. endef
  45. define Package/libatomic
  46. $(call Package/gcc/Default)
  47. DEPENDS:=+libgcc
  48. TITLE:=Atomic support library
  49. endef
  50. define Package/libatomic/config
  51. menu "Configuration"
  52. depends on EXTERNAL_TOOLCHAIN && PACKAGE_libatomic
  53. config LIBATOMIC_ROOT_DIR
  54. string
  55. prompt "libatomic shared library base directory"
  56. depends on EXTERNAL_TOOLCHAIN && PACKAGE_libatomic
  57. default TOOLCHAIN_ROOT if !NATIVE_TOOLCHAIN
  58. default "/" if NATIVE_TOOLCHAIN
  59. config LIBATOMIC_FILE_SPEC
  60. string
  61. prompt "libatomic shared library files (use wildcards)"
  62. depends on EXTERNAL_TOOLCHAIN && PACKAGE_libatomic
  63. default "./lib/libatomic.so.*"
  64. endmenu
  65. endef
  66. define Package/libssp
  67. $(call Package/gcc/Default)
  68. DEPENDS+=@SSP_SUPPORT
  69. TITLE:=GCC support library
  70. endef
  71. define Package/libssp/config
  72. menu "Configuration"
  73. depends on EXTERNAL_TOOLCHAIN && PACKAGE_libssp
  74. config LIBSSP_ROOT_DIR
  75. string
  76. prompt "libssp shared library base directory"
  77. depends on EXTERNAL_TOOLCHAIN && PACKAGE_libssp
  78. default TOOLCHAIN_ROOT if !NATIVE_TOOLCHAIN
  79. default "/" if NATIVE_TOOLCHAIN
  80. config LIBSSP_FILE_SPEC
  81. string
  82. prompt "libssp shared library files (use wildcards)"
  83. depends on EXTERNAL_TOOLCHAIN && PACKAGE_libssp
  84. default "./lib/libssp.so.*"
  85. endmenu
  86. endef
  87. define Package/libstdcpp
  88. $(call Package/gcc/Default)
  89. NAME:=libstdc++
  90. TITLE:=GNU Standard C++ Library v3
  91. endef
  92. define Package/libstdcpp/config
  93. menu "Configuration"
  94. depends on EXTERNAL_TOOLCHAIN && PACKAGE_libstdcpp
  95. config LIBSTDCPP_ROOT_DIR
  96. string
  97. prompt "libstdcpp shared library base directory"
  98. depends on EXTERNAL_TOOLCHAIN && PACKAGE_libstdcpp
  99. default TOOLCHAIN_ROOT if !NATIVE_TOOLCHAIN
  100. default "/" if NATIVE_TOOLCHAIN
  101. config LIBSTDCPP_FILE_SPEC
  102. string
  103. prompt "libstdc++ shared library files (use wildcards)"
  104. depends on EXTERNAL_TOOLCHAIN && PACKAGE_libstdcpp
  105. default "./lib/libstdc++.so.*"
  106. endmenu
  107. endef
  108. define Package/libc/Default
  109. SECTION:=libs
  110. CATEGORY:=Base system
  111. VERSION:=$(LIBC_VERSION)-$(PKG_RELEASE)
  112. DEPENDS:=+libgcc
  113. URL:=$(LIBC_URL)
  114. PKG_FLAGS:=hold essential
  115. endef
  116. define Package/libc
  117. $(call Package/libc/Default)
  118. TITLE:=C library
  119. endef
  120. define Package/libc/config
  121. menu "Configuration"
  122. depends on EXTERNAL_TOOLCHAIN && PACKAGE_libc
  123. config LIBC_ROOT_DIR
  124. string
  125. prompt "libc shared library base directory"
  126. depends on EXTERNAL_TOOLCHAIN && PACKAGE_libc
  127. default TOOLCHAIN_ROOT if !NATIVE_TOOLCHAIN
  128. default "/" if NATIVE_TOOLCHAIN
  129. config LIBC_FILE_SPEC
  130. string
  131. prompt "libc shared library files (use wildcards)"
  132. depends on EXTERNAL_TOOLCHAIN && PACKAGE_libc
  133. default "./lib/ld{-*.so,-linux*.so.*} ./lib/lib{anl,c,cidn,crypt,dl,m,nsl,nss_dns,nss_files,resolv,util}{-*.so,.so.*}"
  134. endmenu
  135. endef
  136. define Package/libpthread
  137. $(call Package/libc/Default)
  138. TITLE:=POSIX thread library
  139. endef
  140. define Package/libpthread/config
  141. menu "Configuration"
  142. depends on EXTERNAL_TOOLCHAIN && PACKAGE_libpthread
  143. config LIBPTHREAD_ROOT_DIR
  144. string
  145. prompt "libpthread shared library base directory"
  146. depends on EXTERNAL_TOOLCHAIN && PACKAGE_libpthread
  147. default TOOLCHAIN_ROOT if !NATIVE_TOOLCHAIN
  148. default "/" if NATIVE_TOOLCHAIN
  149. config LIBPTHREAD_FILE_SPEC
  150. string
  151. prompt "libpthread shared library files (use wildcards)"
  152. depends on EXTERNAL_TOOLCHAIN && PACKAGE_libpthread
  153. default "./lib/libpthread{-*.so,.so.*}"
  154. endmenu
  155. endef
  156. define Package/libthread-db
  157. $(call Package/libc/Default)
  158. DEPENDS:=@!USE_MUSL
  159. TITLE:=POSIX thread library debugging support
  160. endef
  161. define Package/librt
  162. $(call Package/libc/Default)
  163. TITLE:=POSIX.1b RealTime extension library
  164. DEPENDS:=+libpthread
  165. endef
  166. define Package/librt/config
  167. menu "Configuration"
  168. depends on EXTERNAL_TOOLCHAIN && PACKAGE_librt
  169. config LIBRT_ROOT_DIR
  170. string
  171. prompt "librt shared library base directory"
  172. depends on EXTERNAL_TOOLCHAIN && PACKAGE_librt
  173. default TOOLCHAIN_ROOT if !NATIVE_TOOLCHAIN
  174. default "/" if NATIVE_TOOLCHAIN
  175. config LIBRT_FILE_SPEC
  176. string
  177. prompt "librt shared library files (use wildcards)"
  178. depends on EXTERNAL_TOOLCHAIN && PACKAGE_librt
  179. default "./lib/librt{-*.so,.so.*}"
  180. endmenu
  181. endef
  182. define Package/libgfortran
  183. $(call Package/gcc/Default)
  184. TITLE:=GFortran support library
  185. DEPENDS+=@INSTALL_GFORTRAN
  186. endef
  187. define Package/libgfortran/config
  188. menu "Configuration"
  189. depends on EXTERNAL_TOOLCHAIN && PACKAGE_libgfortran
  190. config LIBGFORTRAN_ROOT_DIR
  191. string
  192. prompt "libgfortran shared library base directory"
  193. depends on EXTERNAL_TOOLCHAIN && PACKAGE_libgfortran
  194. default TOOLCHAIN_ROOT if !NATIVE_TOOLCHAIN
  195. default "/" if NATIVE_TOOLCHAIN
  196. config LIBGFORTRAN_FILE_SPEC
  197. string
  198. prompt "libgfortran shared library files (use wildcards)"
  199. depends on EXTERNAL_TOOLCHAIN && PACKAGE_libgfortran
  200. default "./usr/lib/libgfortran.so.*"
  201. endmenu
  202. endef
  203. define Package/ldd
  204. $(call Package/libc/Default)
  205. DEPENDS:=@!USE_MUSL
  206. SECTION:=utils
  207. CATEGORY:=Utilities
  208. TITLE:=LDD trace utility
  209. endef
  210. define Package/ldd/config
  211. menu "Configuration"
  212. depends on EXTERNAL_TOOLCHAIN && PACKAGE_ldd
  213. config LDD_ROOT_DIR
  214. string
  215. prompt "ldd trace utility base directory"
  216. depends on EXTERNAL_TOOLCHAIN && PACKAGE_ldd
  217. default TOOLCHAIN_ROOT if !NATIVE_TOOLCHAIN
  218. default "/" if NATIVE_TOOLCHAIN
  219. config LDD_FILE_SPEC
  220. string
  221. prompt "ldd trace utility file"
  222. depends on EXTERNAL_TOOLCHAIN && PACKAGE_ldd
  223. default "./usr/bin/ldd"
  224. endmenu
  225. endef
  226. define Package/ldconfig
  227. $(call Package/libc/Default)
  228. DEPENDS:=@!USE_MUSL
  229. SECTION:=utils
  230. CATEGORY:=Utilities
  231. TITLE:=Shared library path configuration
  232. endef
  233. define Package/ldconfig/config
  234. menu "Configuration"
  235. depends on EXTERNAL_TOOLCHAIN && PACKAGE_ldconfig
  236. config LDCONFIG_ROOT_DIR
  237. string
  238. prompt "ldconfig base directory"
  239. depends on EXTERNAL_TOOLCHAIN && PACKAGE_ldconfig
  240. default TOOLCHAIN_ROOT if !NATIVE_TOOLCHAIN
  241. default "/" if NATIVE_TOOLCHAIN
  242. config LDCONFIG_FILE_SPEC
  243. string
  244. prompt "ldconfig file"
  245. depends on EXTERNAL_TOOLCHAIN && PACKAGE_ldconfig
  246. default "./sbin/ldconfig"
  247. endmenu
  248. endef
  249. define Build/Prepare
  250. mkdir -p $(PKG_BUILD_DIR)
  251. endef
  252. LIBGCC_A=$(lastword $(wildcard $(TOOLCHAIN_DIR)/lib/gcc/*/*/libgcc_pic.a))
  253. LIBGCC_MAP=$(lastword $(wildcard $(TOOLCHAIN_DIR)/lib/gcc/*/*/libgcc.map))
  254. LIBGCC_SO=$(lastword $(wildcard $(TOOLCHAIN_DIR)/lib/libgcc_s.so.*))
  255. ifeq ($(CONFIG_EXTERNAL_TOOLCHAIN),)
  256. ifneq ($(if $(CONFIG_USE_UCLIBC),$(CONFIG_GCC_VERSION_LINARO)),)
  257. BUILD_LIBGCC:=$(if $(CONFIG_m68k)$(CONFIG_powerpc),,$(PKG_BUILD_DIR)/libgcc_s.so.*)
  258. endif
  259. endif
  260. ifneq ($(BUILD_LIBGCC),)
  261. define Build/Compile/uClibc
  262. $(SCRIPT_DIR)/relink-lib.sh \
  263. "$(TARGET_CROSS)" \
  264. "$(wildcard $(TOOLCHAIN_DIR)/lib/libc_so.a)" \
  265. "$(wildcard $(TOOLCHAIN_DIR)/lib/libc_so.a)" \
  266. "$(patsubst $(TOOLCHAIN_DIR)/lib/%,$(PKG_BUILD_DIR)/%,$(wildcard $(TOOLCHAIN_DIR)/lib/libuClibc-*.so))" \
  267. -Wl,-init,__uClibc_init -Wl,-soname=libc.so.0 \
  268. $(BUILD_LIBGCC)
  269. $(SCRIPT_DIR)/relink-lib.sh \
  270. "$(TARGET_CROSS)" \
  271. "$(wildcard $(TOOLCHAIN_DIR)/lib/libcrypt-*.so)" \
  272. "$(wildcard $(TOOLCHAIN_DIR)/lib/libcrypt_pic.a)" \
  273. "$(patsubst $(TOOLCHAIN_DIR)/lib/%,$(PKG_BUILD_DIR)/%,$(wildcard $(TOOLCHAIN_DIR)/lib/libcrypt-*.so))" \
  274. $(BUILD_LIBGCC) \
  275. -Wl,-soname=libcrypt.so.0
  276. $(SCRIPT_DIR)/relink-lib.sh \
  277. "$(TARGET_CROSS)" \
  278. "$(wildcard $(TOOLCHAIN_DIR)/lib/libatomic.so)" \
  279. "$(wildcard $(TOOLCHAIN_DIR)/lib/libatomic.a)" \
  280. "$(patsubst $(TOOLCHAIN_DIR)/lib/%,$(PKG_BUILD_DIR)/%,$(wildcard $(TOOLCHAIN_DIR)/lib/libatomic*.so))" \
  281. $(BUILD_LIBGCC) \
  282. -Wl,-soname=libatomic.so.0
  283. $(SCRIPT_DIR)/relink-lib.sh \
  284. "$(TARGET_CROSS)" \
  285. "$(wildcard $(TOOLCHAIN_DIR)/lib/libm-*.so)" \
  286. "$(wildcard $(TOOLCHAIN_DIR)/lib/libm_pic.a)" \
  287. "$(patsubst $(TOOLCHAIN_DIR)/lib/%,$(PKG_BUILD_DIR)/%,$(wildcard $(TOOLCHAIN_DIR)/lib/libm-*.so))" \
  288. $(BUILD_LIBGCC) \
  289. -Wl,-soname=libm.so.0
  290. $(SCRIPT_DIR)/relink-lib.sh \
  291. "$(TARGET_CROSS)" \
  292. "$(wildcard $(TOOLCHAIN_DIR)/lib/libpthread-*.so)" \
  293. "$(wildcard $(TOOLCHAIN_DIR)/lib/libpthread_so.a)" \
  294. "$(patsubst $(TOOLCHAIN_DIR)/lib/%,$(PKG_BUILD_DIR)/%,$(wildcard $(TOOLCHAIN_DIR)/lib/libpthread-*.so))" \
  295. -Wl,-z,nodelete,-z,initfirst,-init=__pthread_initialize_minimal_internal \
  296. -ldl -lc $(BUILD_LIBGCC) \
  297. -Wl,-soname=libpthread.so.0
  298. endef
  299. define Build/Compile/libgcc
  300. $(SCRIPT_DIR)/relink-lib.sh \
  301. "$(TARGET_CROSS)" \
  302. "$(LIBGCC_SO)" \
  303. "$(LIBGCC_A)" \
  304. "$(patsubst $(TOOLCHAIN_DIR)/lib/%,$(PKG_BUILD_DIR)/%,$(LIBGCC_SO))" \
  305. -Wl,--version-script=$(LIBGCC_MAP) -Wl,-soname=libgcc_s.so.1
  306. endef
  307. else
  308. define Build/Compile/uClibc
  309. $(CP) \
  310. $(TOOLCHAIN_DIR)/lib/libuClibc-*.so \
  311. $(TOOLCHAIN_DIR)/lib/libcrypt-*.so \
  312. $(TOOLCHAIN_DIR)/lib/libm-*.so \
  313. $(TOOLCHAIN_DIR)/lib/libpthread-*.so \
  314. $(PKG_BUILD_DIR)/
  315. endef
  316. ifneq ($(LIBGCC_SO),)
  317. define Build/Compile/libgcc
  318. $(CP) $(LIBGCC_SO) $(PKG_BUILD_DIR)/
  319. endef
  320. endif
  321. endif
  322. define Build/Compile/Default
  323. $(call Build/Compile/libgcc)
  324. $(call Build/Compile/$(LIBC))
  325. endef
  326. Build/Compile = $(Build/Compile/Default)
  327. ifeq ($(CONFIG_EXTERNAL_TOOLCHAIN),)
  328. define Package/libgcc/install
  329. $(INSTALL_DIR) $(1)/lib
  330. $(CP) $(TOOLCHAIN_DIR)/lib/libgcc_s.so.* $(1)/lib/
  331. endef
  332. define Package/libatomic/install
  333. $(INSTALL_DIR) $(1)/lib
  334. $(if $(CONFIG_GCC_VERSION_4_6),,$(CP) $(TOOLCHAIN_DIR)/lib/libatomic.so.* $(1)/lib/)
  335. endef
  336. define Package/libgfortran/install
  337. $(INSTALL_DIR) $(1)/usr/lib
  338. $(CP) $(TOOLCHAIN_DIR)/lib/libgfortran.so.* $(1)/usr/lib/
  339. endef
  340. define Package/libssp/install
  341. $(INSTALL_DIR) $(1)/lib
  342. $(CP) $(TOOLCHAIN_DIR)/lib/libssp.so.* $(1)/lib/
  343. endef
  344. define Package/libstdcpp/install
  345. $(INSTALL_DIR) $(1)/usr/lib
  346. $(CP) $(TOOLCHAIN_DIR)/lib/libstdc++.so.* $(1)/usr/lib/
  347. endef
  348. use_libutil=$(if $(CONFIG_GLIBC_USE_VERSION_2_21)$(CONFIG_EGLIBC_OPTION_EGLIBC_UTMP),libutil)
  349. use_libnsl=$(if $(CONFIG_GLIBC_USE_VERSION_2_21)$(CONFIG_EGLIBC_OPTION_EGLIBC_NIS),libnsl)
  350. use_nsswitch=$(if $(CONFIG_GLIBC_USE_VERSION_2_21)$(CONFIG_EGLIBC_OPTION_EGLIBC_NSSWITCH),libnss_dns libnss_files)
  351. define Package/glibc/install
  352. $(CP) ./glibc-files/* $(1)/
  353. rm -f $(1)/etc/localtime
  354. $(LN) /tmp/localtime $(1)/etc/localtime
  355. $(INSTALL_DIR) $(1)/lib
  356. $(CP) \
  357. $(TOOLCHAIN_DIR)/lib/ld*.so.* \
  358. $(TOOLCHAIN_DIR)/lib/ld-$(LIBC_SO_VERSION).so \
  359. $(1)/lib/
  360. for file in libanl libc libcidn libcrypt libdl libm $(use_libnsl) $(use_nsswitch) libresolv $(use_libutil); do \
  361. for file in $(TOOLCHAIN_DIR)/lib/$$$$file.so.* $(TOOLCHAIN_DIR)/lib/$$$$file-$(LIBC_SO_VERSION).so; do \
  362. if [ -e "$$$$file" ]; then \
  363. $(CP) $$$$file $(1)/lib/; \
  364. fi; \
  365. done; \
  366. done
  367. endef
  368. define Package/uClibc/install
  369. $(INSTALL_DIR) $(1)/lib
  370. $(CP) \
  371. $(TOOLCHAIN_DIR)/lib/ld*-uClibc.so.* \
  372. $(TOOLCHAIN_DIR)/lib/ld*-uClibc-$(LIBC_SO_VERSION).so \
  373. $(1)/lib/
  374. $(CP) \
  375. $(TOOLCHAIN_DIR)/lib/libc.so.* \
  376. $(TOOLCHAIN_DIR)/lib/libuClibc-$(LIBC_SO_VERSION).so \
  377. $(1)/lib/
  378. for file in libcrypt libdl libm libutil; do \
  379. $(CP) \
  380. $(TOOLCHAIN_DIR)/lib/$$$$file.so.* \
  381. $(TOOLCHAIN_DIR)/lib/$$$$file-$(LIBC_SO_VERSION).so \
  382. $(1)/lib/; \
  383. done
  384. $(CP) \
  385. $(PKG_BUILD_DIR)/libuClibc-* \
  386. $(PKG_BUILD_DIR)/libm-* \
  387. $(PKG_BUILD_DIR)/libcrypt-* \
  388. $(1)/lib/
  389. endef
  390. LD_MUSL_NAME = $(notdir $(firstword $(wildcard $(TOOLCHAIN_DIR)/lib/libc.so*)))
  391. define Package/musl/install
  392. $(INSTALL_DIR) $(1)/lib $(1)/usr/bin
  393. $(CP) \
  394. $(TOOLCHAIN_DIR)/lib/ld-musl-*.so* \
  395. $(1)/lib/
  396. $(CP) \
  397. $(TOOLCHAIN_DIR)/lib/libc.so* \
  398. $(1)/lib/
  399. $(LN) ../../lib/$(LD_MUSL_NAME) $(1)/usr/bin/ldd
  400. endef
  401. define Package/libc/install
  402. $(call Package/$(LIBC)/install,$1)
  403. endef
  404. define Package/libc/install_lib
  405. $(CP) $(filter-out %/libdl_pic.a %/libpthread_pic.a %/libresolv_pic.a,$(wildcard $(TOOLCHAIN_DIR)/lib/lib*.a)) $(1)/lib/
  406. $(if $(wildcard $(TOOLCHAIN_DIR)/lib/libc_so.a),$(CP) $(TOOLCHAIN_DIR)/lib/libc_so.a $(1)/lib/libc_pic.a)
  407. $(if $(LIBGCC_MAP), \
  408. $(CP) $(LIBGCC_A) $(1)/lib/libgcc_s_pic.a; \
  409. $(CP) $(LIBGCC_MAP) $(1)/lib/libgcc_s_pic.map \
  410. )
  411. endef
  412. define Package/libpthread/install
  413. $(INSTALL_DIR) $(1)/lib
  414. ifneq ($(CONFIG_USE_MUSL),y)
  415. $(CP) \
  416. $(TOOLCHAIN_DIR)/lib/libpthread.so.* \
  417. $(if $(BUILD_LIBGCC),\
  418. $(PKG_BUILD_DIR)/libpthread-$(LIBC_SO_VERSION).so, \
  419. $(TOOLCHAIN_DIR)/lib/libpthread-$(LIBC_SO_VERSION).so \
  420. ) \
  421. $(1)/lib/
  422. endif
  423. endef
  424. define Package/libthread-db/install
  425. $(INSTALL_DIR) $(1)/lib
  426. $(CP) \
  427. $(TOOLCHAIN_DIR)/lib/libthread_db.so.* $(1)/lib
  428. ifeq ($(CONFIG_USE_UCLIBC),y)
  429. $(CP) \
  430. $(TOOLCHAIN_DIR)/lib/libthread_db-$(LIBC_SO_VERSION).so \
  431. $(1)/lib/
  432. endif
  433. endef
  434. define Package/libpthread/install_lib
  435. $(if $(wildcard $(TOOLCHAIN_DIR)/lib/libpthread_so.a),$(CP) $(TOOLCHAIN_DIR)/lib/libpthread_so.a $(1)/lib/libpthread_pic.a)
  436. endef
  437. define Package/librt/install
  438. $(INSTALL_DIR) $(1)/lib
  439. ifneq ($(CONFIG_USE_MUSL),y)
  440. $(CP) \
  441. $(TOOLCHAIN_DIR)/lib/librt.so.* \
  442. $(TOOLCHAIN_DIR)/lib/librt-$(LIBC_SO_VERSION).so \
  443. $(1)/lib/
  444. endif
  445. endef
  446. define Package/ldd/install
  447. $(INSTALL_DIR) $(1)/usr/bin/
  448. $(CP) $(TOOLCHAIN_DIR)/bin/ldd $(1)/usr/bin/
  449. endef
  450. define Package/ldconfig/install
  451. $(INSTALL_DIR) $(1)/sbin/
  452. $(CP) $(TOOLCHAIN_DIR)/sbin/ldconfig $(1)/sbin/
  453. endef
  454. else
  455. define Package/libgcc/install
  456. for file in $(call qstrip,$(CONFIG_LIBGCC_FILE_SPEC)); do \
  457. dir=`dirname $$$$file` ; \
  458. $(INSTALL_DIR) $(1)/$$$$dir ; \
  459. $(CP) $(call qstrip,$(CONFIG_LIBGCC_ROOT_DIR))/$$$$file $(1)/$$$$dir/ ; \
  460. done ; \
  461. exit 0
  462. endef
  463. define Package/libgfortran/install
  464. for file in $(call qstrip,$(CONFIG_LIBGFORTRAN_FILE_SPEC)); do \
  465. dir=`dirname $$$$file` ; \
  466. $(INSTALL_DIR) $(1)/$$$$dir ; \
  467. $(CP) $(call qstrip,$(CONFIG_LIBGFORTRAN_ROOT_DIR))/$$$$file $(1)/$$$$dir/ ; \
  468. done
  469. endef
  470. define Package/libssp/install
  471. for file in $(call qstrip,$(CONFIG_LIBSSP_FILE_SPEC)); do \
  472. dir=`dirname $$$$file` ; \
  473. $(INSTALL_DIR) $(1)/$$$$dir ; \
  474. $(CP) $(call qstrip,$(CONFIG_LIBSSP_ROOT_DIR))/$$$$file $(1)/$$$$dir/ ; \
  475. done ; \
  476. exit 0
  477. endef
  478. define Package/libstdcpp/install
  479. for file in $(call qstrip,$(CONFIG_LIBSTDCPP_FILE_SPEC)); do \
  480. dir=`dirname $$$$file` ; \
  481. $(INSTALL_DIR) $(1)/$$$$dir ; \
  482. $(CP) $(call qstrip,$(CONFIG_LIBSTDCPP_ROOT_DIR))/$$$$file $(1)/$$$$dir/ ; \
  483. done ; \
  484. exit 0
  485. endef
  486. define Package/libc/install
  487. for file in $(call qstrip,$(CONFIG_LIBC_FILE_SPEC)); do \
  488. dir=`dirname $$$$file` ; \
  489. $(INSTALL_DIR) $(1)/$$$$dir ; \
  490. $(CP) $(call qstrip,$(CONFIG_LIBC_ROOT_DIR))/$$$$file $(1)/$$$$dir/ ; \
  491. done ; \
  492. exit 0
  493. endef
  494. define Package/libpthread/install
  495. for file in $(call qstrip,$(CONFIG_LIBPTHREAD_FILE_SPEC)); do \
  496. dir=`dirname $$$$file` ; \
  497. $(INSTALL_DIR) $(1)/$$$$dir ; \
  498. $(CP) $(call qstrip,$(CONFIG_LIBPTHREAD_ROOT_DIR))/$$$$file $(1)/$$$$dir/ ; \
  499. done ; \
  500. exit 0
  501. endef
  502. define Package/librt/install
  503. for file in $(call qstrip,$(CONFIG_LIBRT_FILE_SPEC)); do \
  504. dir=`dirname $$$$file` ; \
  505. $(INSTALL_DIR) $(1)/$$$$dir ; \
  506. $(CP) $(call qstrip,$(CONFIG_LIBRT_ROOT_DIR))/$$$$file $(1)/$$$$dir/ ; \
  507. done ; \
  508. exit 0
  509. endef
  510. define Package/libatomic/install
  511. for file in $(call qstrip,$(CONFIG_LIBATOMIC_FILE_SPEC)); do \
  512. dir=`dirname $$$$file` ; \
  513. $(INSTALL_DIR) $(1)/$$$$dir ; \
  514. $(CP) $(call qstrip,$(CONFIG_LIBATOMIC_ROOT_DIR))/$$$$file $(1)/$$$$dir/ ; \
  515. done ; \
  516. exit 0
  517. endef
  518. define Package/ldd/install
  519. for file in $(call qstrip,$(CONFIG_LDD_FILE_SPEC)); do \
  520. dir=`dirname $$$$file` ; \
  521. $(INSTALL_DIR) $(1)/$$$$dir ; \
  522. $(CP) $(call qstrip,$(CONFIG_LDD_ROOT_DIR))/$$$$file $(1)/$$$$dir/ ; \
  523. done ; \
  524. exit 0
  525. endef
  526. define Package/ldconfig/install
  527. for file in $(call qstrip,$(CONFIG_LDCONFIG_FILE_SPEC)); do \
  528. dir=`dirname $$$$file` ; \
  529. $(INSTALL_DIR) $(1)/$$$$dir ; \
  530. $(CP) $(call qstrip,$(CONFIG_LDCONFIG_ROOT_DIR))/$$$$file $(1)/$$$$dir/ ; \
  531. done ; \
  532. exit 0
  533. endef
  534. endif
  535. $(eval $(call BuildPackage,libc))
  536. $(eval $(call BuildPackage,libgcc))
  537. $(eval $(call BuildPackage,libatomic))
  538. $(eval $(call BuildPackage,libssp))
  539. $(eval $(call BuildPackage,libstdcpp))
  540. $(eval $(call BuildPackage,libpthread))
  541. $(eval $(call BuildPackage,libthread-db))
  542. $(eval $(call BuildPackage,librt))
  543. $(eval $(call BuildPackage,libgfortran))
  544. $(eval $(call BuildPackage,ldd))
  545. $(eval $(call BuildPackage,ldconfig))