Makefile 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804
  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:=2
  10. PKG_MAINTAINER:=Felix Fietkau <[email protected]>
  11. PKG_LICENSE:=GPL-3.0-with-GCC-exception
  12. PKG_FLAGS:=hold essential nonshared
  13. include $(INCLUDE_DIR)/package.mk
  14. ifneq ($(DUMP),1)
  15. LIBGCC_VERSION:=$(GCC_VERSION)
  16. else
  17. LIBC_VERSION:=<LIBC_VERSION>
  18. LIBGCC_VERSION:=<LIBGCC_VERSION>
  19. endif
  20. define Package/gcc/Default
  21. SECTION:=libs
  22. CATEGORY:=Base system
  23. URL:=http://gcc.gnu.org/
  24. VERSION:=$(LIBGCC_VERSION)-$(PKG_RELEASE)
  25. endef
  26. define Package/libgcc
  27. $(call Package/gcc/Default)
  28. TITLE:=GCC support library
  29. ABI_VERSION:=1
  30. endef
  31. define Package/libgcc/config
  32. menu "Configuration"
  33. depends on EXTERNAL_TOOLCHAIN && PACKAGE_libgcc
  34. config LIBGCC_ROOT_DIR
  35. string
  36. prompt "libgcc shared library base directory"
  37. depends on EXTERNAL_TOOLCHAIN && PACKAGE_libgcc
  38. default TOOLCHAIN_ROOT if !NATIVE_TOOLCHAIN
  39. default "/" if NATIVE_TOOLCHAIN
  40. config LIBGCC_FILE_SPEC
  41. string
  42. prompt "libgcc shared library files (use wildcards)"
  43. depends on EXTERNAL_TOOLCHAIN && PACKAGE_libgcc
  44. default "./lib/libgcc_s.so.*"
  45. endmenu
  46. endef
  47. define Package/libatomic
  48. $(call Package/gcc/Default)
  49. DEPENDS:=+libgcc
  50. TITLE:=Atomic support library
  51. ABI_VERSION:=1
  52. endef
  53. define Package/libatomic/config
  54. menu "Configuration"
  55. depends on EXTERNAL_TOOLCHAIN && PACKAGE_libatomic
  56. config LIBATOMIC_ROOT_DIR
  57. string
  58. prompt "libatomic shared library base directory"
  59. depends on EXTERNAL_TOOLCHAIN && PACKAGE_libatomic
  60. default TOOLCHAIN_ROOT if !NATIVE_TOOLCHAIN
  61. default "/" if NATIVE_TOOLCHAIN
  62. config LIBATOMIC_FILE_SPEC
  63. string
  64. prompt "libatomic shared library files (use wildcards)"
  65. depends on EXTERNAL_TOOLCHAIN && PACKAGE_libatomic
  66. default "./lib/libatomic.so.*"
  67. endmenu
  68. endef
  69. define Package/libssp
  70. $(call Package/gcc/Default)
  71. DEPENDS+=@GCC_LIBSSP
  72. TITLE:=GCC support library
  73. endef
  74. define Package/libssp/config
  75. menu "Configuration"
  76. depends on EXTERNAL_TOOLCHAIN && PACKAGE_libssp
  77. config LIBSSP_ROOT_DIR
  78. string
  79. prompt "libssp shared library base directory"
  80. depends on EXTERNAL_TOOLCHAIN && PACKAGE_libssp
  81. default TOOLCHAIN_ROOT if !NATIVE_TOOLCHAIN
  82. default "/" if NATIVE_TOOLCHAIN
  83. config LIBSSP_FILE_SPEC
  84. string
  85. prompt "libssp shared library files (use wildcards)"
  86. depends on EXTERNAL_TOOLCHAIN && PACKAGE_libssp
  87. default "./lib/libssp.so.*"
  88. endmenu
  89. endef
  90. define Package/libstdcpp
  91. $(call Package/gcc/Default)
  92. NAME:=libstdc++
  93. TITLE:=GNU Standard C++ Library v3
  94. ABI_VERSION:=6
  95. endef
  96. define Package/libstdcpp/config
  97. menu "Configuration"
  98. depends on EXTERNAL_TOOLCHAIN && PACKAGE_libstdcpp
  99. config LIBSTDCPP_ROOT_DIR
  100. string
  101. prompt "libstdcpp shared library base directory"
  102. depends on EXTERNAL_TOOLCHAIN && PACKAGE_libstdcpp
  103. default TOOLCHAIN_ROOT if !NATIVE_TOOLCHAIN
  104. default "/" if NATIVE_TOOLCHAIN
  105. config LIBSTDCPP_FILE_SPEC
  106. string
  107. prompt "libstdc++ shared library files (use wildcards)"
  108. depends on EXTERNAL_TOOLCHAIN && PACKAGE_libstdcpp
  109. default "./lib/libstdc++.so.*"
  110. endmenu
  111. endef
  112. define Package/libasan
  113. $(call Package/gcc/Default)
  114. NAME:=libasan
  115. TITLE:=Runtime library for AddressSanitizer in GCC
  116. DEPENDS:=@USE_GLIBC +librt +libstdcpp
  117. ABI_VERSION:=5
  118. endef
  119. define Package/libasan/config
  120. menu "Configuration"
  121. depends on EXTERNAL_TOOLCHAIN && PACKAGE_libasan
  122. config LIBASAN_ROOT_DIR
  123. string
  124. prompt "libasan shared library base directory"
  125. depends on EXTERNAL_TOOLCHAIN && PACKAGE_libasan
  126. default TOOLCHAIN_ROOT if !NATIVE_TOOLCHAIN
  127. default "/" if NATIVE_TOOLCHAIN
  128. config LIBASAN_FILE_SPEC
  129. string
  130. prompt "libasan shared library files (use wildcards)"
  131. depends on EXTERNAL_TOOLCHAIN && PACKAGE_libasan
  132. default "./lib/libasan.so.*"
  133. endmenu
  134. endef
  135. define Package/libtsan
  136. $(call Package/gcc/Default)
  137. NAME:=libtsan
  138. TITLE:=Runtime library for ThreadSanitizer in GCC
  139. DEPENDS:=@USE_GLIBC +librt +libstdcpp
  140. ABI_VERSION:=0
  141. endef
  142. define Package/libtsan/config
  143. menu "Configuration"
  144. depends on EXTERNAL_TOOLCHAIN && PACKAGE_libtsan
  145. config LIBTSAN_ROOT_DIR
  146. string
  147. prompt "libtsan shared library base directory"
  148. depends on EXTERNAL_TOOLCHAIN && PACKAGE_libtsan
  149. default TOOLCHAIN_ROOT if !NATIVE_TOOLCHAIN
  150. default "/" if NATIVE_TOOLCHAIN
  151. config LIBTSAN_FILE_SPEC
  152. string
  153. prompt "libtsan shared library files (use wildcards)"
  154. depends on EXTERNAL_TOOLCHAIN && PACKAGE_libtsan
  155. default "./lib/libtsan.so.*"
  156. endmenu
  157. endef
  158. define Package/liblsan
  159. $(call Package/gcc/Default)
  160. NAME:=liblsan
  161. TITLE:=Runtime library for LeakSanitizer in GCC
  162. DEPENDS:=@USE_GLIBC +librt +libstdcpp
  163. ABI_VERSION:=0
  164. endef
  165. define Package/liblsan/config
  166. menu "Configuration"
  167. depends on EXTERNAL_TOOLCHAIN && PACKAGE_liblsan
  168. config LIBLSAN_ROOT_DIR
  169. string
  170. prompt "liblsan shared library base directory"
  171. depends on EXTERNAL_TOOLCHAIN && PACKAGE_liblsan
  172. default TOOLCHAIN_ROOT if !NATIVE_TOOLCHAIN
  173. default "/" if NATIVE_TOOLCHAIN
  174. config LIBLSAN_FILE_SPEC
  175. string
  176. prompt "liblsan shared library files (use wildcards)"
  177. depends on EXTERNAL_TOOLCHAIN && PACKAGE_liblsan
  178. default "./lib/liblsan.so.*"
  179. endmenu
  180. endef
  181. define Package/libubsan
  182. $(call Package/gcc/Default)
  183. NAME:=libubsan
  184. TITLE:=Runtime library for UndefinedBehaviorSanitizer in GCC
  185. DEPENDS:=@USE_GLIBC +librt +libstdcpp
  186. ABI_VERSION:=1
  187. endef
  188. define Package/libubsan/config
  189. menu "Configuration"
  190. depends on EXTERNAL_TOOLCHAIN && PACKAGE_libubsan
  191. config LIBUBSAN_ROOT_DIR
  192. string
  193. prompt "libubsan shared library base directory"
  194. depends on EXTERNAL_TOOLCHAIN && PACKAGE_libubsan
  195. default TOOLCHAIN_ROOT if !NATIVE_TOOLCHAIN
  196. default "/" if NATIVE_TOOLCHAIN
  197. config LIBUBSAN_FILE_SPEC
  198. string
  199. prompt "libubsan shared library files (use wildcards)"
  200. depends on EXTERNAL_TOOLCHAIN && PACKAGE_libubsan
  201. default "./lib/libubsan.so.*"
  202. endmenu
  203. endef
  204. define Package/libc/Default
  205. SECTION:=libs
  206. CATEGORY:=Base system
  207. VERSION:=$(LIBC_VERSION)-$(PKG_RELEASE)
  208. DEPENDS:=+libgcc
  209. URL:=$(LIBC_URL)
  210. endef
  211. define Package/libc
  212. $(call Package/libc/Default)
  213. TITLE:=C library
  214. endef
  215. define Package/libc/config
  216. menu "Configuration"
  217. depends on EXTERNAL_TOOLCHAIN && PACKAGE_libc
  218. config LIBC_ROOT_DIR
  219. string
  220. prompt "libc shared library base directory"
  221. depends on EXTERNAL_TOOLCHAIN && PACKAGE_libc
  222. default TOOLCHAIN_ROOT if !NATIVE_TOOLCHAIN
  223. default "/" if NATIVE_TOOLCHAIN
  224. config LIBC_FILE_SPEC
  225. string
  226. prompt "libc shared library files (use wildcards)"
  227. depends on EXTERNAL_TOOLCHAIN && PACKAGE_libc
  228. default "./lib/ld{*.so*,-linux*.so.*} ./lib/lib{anl,c,cidn,crypt,dl,m,nsl,nss_dns,nss_files,resolv,util}{-*.so,.so.*,.so}"
  229. endmenu
  230. endef
  231. define Package/libpthread
  232. $(call Package/libc/Default)
  233. TITLE:=POSIX thread library
  234. endef
  235. define Package/libpthread/config
  236. menu "Configuration"
  237. depends on EXTERNAL_TOOLCHAIN && PACKAGE_libpthread
  238. config LIBPTHREAD_ROOT_DIR
  239. string
  240. prompt "libpthread shared library base directory"
  241. depends on EXTERNAL_TOOLCHAIN && PACKAGE_libpthread
  242. default TOOLCHAIN_ROOT if !NATIVE_TOOLCHAIN
  243. default "/" if NATIVE_TOOLCHAIN
  244. config LIBPTHREAD_FILE_SPEC
  245. string
  246. prompt "libpthread shared library files (use wildcards)"
  247. depends on EXTERNAL_TOOLCHAIN && PACKAGE_libpthread
  248. default "./lib/libpthread{-*.so,.so.*}"
  249. endmenu
  250. endef
  251. define Package/libthread-db
  252. $(call Package/libc/Default)
  253. DEPENDS:=@!USE_MUSL
  254. TITLE:=POSIX thread library debugging support
  255. endef
  256. define Package/libthread-db/config
  257. menu "Configuration"
  258. depends on EXTERNAL_TOOLCHAIN && PACKAGE_libthread-db
  259. config LIBTHREAD_DB_ROOT_DIR
  260. string
  261. prompt "POSIX thread debugging shared library base directory"
  262. depends on EXTERNAL_TOOLCHAIN && PACKAGE_libthread-db
  263. default TOOLCHAIN_ROOT if !NATIVE_TOOLCHAIN
  264. default "/" if NATIVE_TOOLCHAIN
  265. config LIBTHREAD_DB_FILE_SPEC
  266. string
  267. prompt "POSIX thread debugging shared library files (use wildcards)"
  268. depends on EXTERNAL_TOOLCHAIN && PACKAGE_libthread-db
  269. default "./lib/libthread_db{-*.so,.so.*}"
  270. endmenu
  271. endef
  272. define Package/librt
  273. $(call Package/libc/Default)
  274. TITLE:=POSIX.1b RealTime extension library
  275. DEPENDS:=+libpthread
  276. endef
  277. define Package/librt/config
  278. menu "Configuration"
  279. depends on EXTERNAL_TOOLCHAIN && PACKAGE_librt
  280. config LIBRT_ROOT_DIR
  281. string
  282. prompt "librt shared library base directory"
  283. depends on EXTERNAL_TOOLCHAIN && PACKAGE_librt
  284. default TOOLCHAIN_ROOT if !NATIVE_TOOLCHAIN
  285. default "/" if NATIVE_TOOLCHAIN
  286. config LIBRT_FILE_SPEC
  287. string
  288. prompt "librt shared library files (use wildcards)"
  289. depends on EXTERNAL_TOOLCHAIN && PACKAGE_librt
  290. default "./lib/librt{-*.so,.so.*}"
  291. endmenu
  292. endef
  293. define Package/libgfortran
  294. $(call Package/gcc/Default)
  295. TITLE:=GFortran support library
  296. DEPENDS+=@INSTALL_GFORTRAN
  297. endef
  298. define Package/libgfortran/config
  299. menu "Configuration"
  300. depends on EXTERNAL_TOOLCHAIN && PACKAGE_libgfortran
  301. config LIBGFORTRAN_ROOT_DIR
  302. string
  303. prompt "libgfortran shared library base directory"
  304. depends on EXTERNAL_TOOLCHAIN && PACKAGE_libgfortran
  305. default TOOLCHAIN_ROOT if !NATIVE_TOOLCHAIN
  306. default "/" if NATIVE_TOOLCHAIN
  307. config LIBGFORTRAN_FILE_SPEC
  308. string
  309. prompt "libgfortran shared library files (use wildcards)"
  310. depends on EXTERNAL_TOOLCHAIN && PACKAGE_libgfortran
  311. default "./usr/lib/libgfortran.so.*"
  312. endmenu
  313. endef
  314. define Package/libgomp
  315. $(call Package/gcc/Default)
  316. TITLE:=OpenMP support library
  317. endef
  318. define Package/libgomp/config
  319. menu "Configuration"
  320. depends on EXTERNAL_TOOLCHAIN && PACKAGE_libgomp
  321. config LIBGOMP_ROOT_DIR
  322. string
  323. prompt "libgomp shared library base directory"
  324. depends on EXTERNAL_TOOLCHAIN && PACKAGE_libgomp
  325. default TOOLCHAIN_ROOT if !NATIVE_TOOLCHAIN
  326. default "/" if NATIVE_TOOLCHAIN
  327. config LIBGOMP_FILE_SPEC
  328. string
  329. prompt "libgomp shared library files (use wildcards)"
  330. depends on EXTERNAL_TOOLCHAIN && PACKAGE_libgomp
  331. default "./lib/libgomp.so*"
  332. endmenu
  333. endef
  334. define Package/ldd
  335. $(call Package/libc/Default)
  336. DEPENDS:=@!USE_MUSL
  337. SECTION:=utils
  338. CATEGORY:=Utilities
  339. TITLE:=LDD trace utility
  340. endef
  341. define Package/ldd/config
  342. menu "Configuration"
  343. depends on EXTERNAL_TOOLCHAIN && PACKAGE_ldd
  344. config LDD_ROOT_DIR
  345. string
  346. prompt "ldd trace utility base directory"
  347. depends on EXTERNAL_TOOLCHAIN && PACKAGE_ldd
  348. default TOOLCHAIN_ROOT if !NATIVE_TOOLCHAIN
  349. default "/" if NATIVE_TOOLCHAIN
  350. config LDD_FILE_SPEC
  351. string
  352. prompt "ldd trace utility file"
  353. depends on EXTERNAL_TOOLCHAIN && PACKAGE_ldd
  354. default "./usr/bin/ldd"
  355. endmenu
  356. endef
  357. define Package/ldconfig
  358. $(call Package/libc/Default)
  359. DEPENDS:=@!USE_MUSL
  360. SECTION:=utils
  361. CATEGORY:=Utilities
  362. TITLE:=Shared library path configuration
  363. endef
  364. define Package/ldconfig/config
  365. menu "Configuration"
  366. depends on EXTERNAL_TOOLCHAIN && PACKAGE_ldconfig
  367. config LDCONFIG_ROOT_DIR
  368. string
  369. prompt "ldconfig base directory"
  370. depends on EXTERNAL_TOOLCHAIN && PACKAGE_ldconfig
  371. default TOOLCHAIN_ROOT if !NATIVE_TOOLCHAIN
  372. default "/" if NATIVE_TOOLCHAIN
  373. config LDCONFIG_FILE_SPEC
  374. string
  375. prompt "ldconfig file"
  376. depends on EXTERNAL_TOOLCHAIN && PACKAGE_ldconfig
  377. default "./sbin/ldconfig"
  378. endmenu
  379. endef
  380. define Build/Prepare
  381. mkdir -p $(PKG_BUILD_DIR)
  382. endef
  383. LIBGCC_A=$(lastword $(wildcard $(TOOLCHAIN_DIR)/lib/gcc/*/*/libgcc_pic.a))
  384. LIBGCC_MAP=$(lastword $(wildcard $(TOOLCHAIN_DIR)/lib/gcc/*/*/libgcc.map))
  385. LIBGCC_SO=$(lastword $(wildcard $(TOOLCHAIN_DIR)/lib/libgcc_s.so.*))
  386. define Build/Compile/uClibc
  387. $(CP) \
  388. $(TOOLCHAIN_DIR)/lib/libuClibc-*.so \
  389. $(PKG_BUILD_DIR)/
  390. endef
  391. ifneq ($(LIBGCC_SO),)
  392. define Build/Compile/libgcc
  393. $(CP) $(LIBGCC_SO) $(PKG_BUILD_DIR)/
  394. endef
  395. endif
  396. define Build/Compile/Default
  397. $(call Build/Compile/libgcc)
  398. $(call Build/Compile/$(LIBC))
  399. endef
  400. Build/Compile = $(Build/Compile/Default)
  401. ifeq ($(CONFIG_EXTERNAL_TOOLCHAIN),)
  402. define Package/libgcc/install
  403. $(INSTALL_DIR) $(1)/lib
  404. $(CP) $(TOOLCHAIN_DIR)/lib/libgcc_s.so.* $(1)/lib/
  405. endef
  406. define Package/libatomic/install
  407. $(INSTALL_DIR) $(1)/lib
  408. $(CP) $(TOOLCHAIN_DIR)/lib/libatomic.so.* $(1)/lib/
  409. endef
  410. define Package/libgfortran/install
  411. $(INSTALL_DIR) $(1)/usr/lib
  412. $(CP) $(TOOLCHAIN_DIR)/lib/libgfortran.so.* $(1)/usr/lib/
  413. endef
  414. define Package/libssp/install
  415. $(INSTALL_DIR) $(1)/lib
  416. $(CP) $(TOOLCHAIN_DIR)/lib/libssp.so.* $(1)/lib/
  417. endef
  418. define Package/libstdcpp/install
  419. $(INSTALL_DIR) $(1)/usr/lib
  420. $(CP) $(TOOLCHAIN_DIR)/lib/libstdc++.so.* $(1)/usr/lib/
  421. endef
  422. define Package/libasan/install
  423. $(INSTALL_DIR) $(1)/lib
  424. $(CP) $(TOOLCHAIN_DIR)/lib/libasan.so.* $(1)/lib/
  425. endef
  426. define Package/libtsan/install
  427. $(INSTALL_DIR) $(1)/lib
  428. $(CP) $(TOOLCHAIN_DIR)/lib/libtsan.so.* $(1)/lib/
  429. endef
  430. define Package/liblsan/install
  431. $(INSTALL_DIR) $(1)/lib
  432. $(CP) $(TOOLCHAIN_DIR)/lib/liblsan.so.* $(1)/lib/
  433. endef
  434. define Package/libubsan/install
  435. $(INSTALL_DIR) $(1)/lib
  436. $(CP) $(TOOLCHAIN_DIR)/lib/libubsan.so.* $(1)/lib/
  437. endef
  438. define Package/glibc/install
  439. $(CP) ./glibc-files/* $(1)/
  440. rm -f $(1)/etc/localtime
  441. $(LN) /tmp/localtime $(1)/etc/localtime
  442. $(INSTALL_DIR) $(1)/lib
  443. $(CP) \
  444. $(TOOLCHAIN_DIR)/lib/ld*.so.* \
  445. $(TOOLCHAIN_DIR)/lib/ld-$(LIBC_SO_VERSION).so \
  446. $(1)/lib/
  447. for file in libanl libc libcidn libcrypt libdl libm libnsl libnss_dns libnss_files libresolv libutil; do \
  448. for file in $(TOOLCHAIN_DIR)/lib/$$$$file.so.* $(TOOLCHAIN_DIR)/lib/$$$$file-$(LIBC_SO_VERSION).so; do \
  449. if [ -e "$$$$file" ]; then \
  450. $(CP) $$$$file $(1)/lib/; \
  451. fi; \
  452. done; \
  453. done
  454. endef
  455. define Package/uClibc/install
  456. $(INSTALL_DIR) $(1)/lib
  457. $(CP) \
  458. $(TOOLCHAIN_DIR)/lib/ld*-uClibc.so.* \
  459. $(TOOLCHAIN_DIR)/lib/ld*-uClibc-$(LIBC_SO_VERSION).so \
  460. $(1)/lib/
  461. $(CP) \
  462. $(TOOLCHAIN_DIR)/lib/libc.so.* \
  463. $(TOOLCHAIN_DIR)/lib/libuClibc-$(LIBC_SO_VERSION).so \
  464. $(1)/lib/
  465. $(CP) \
  466. $(PKG_BUILD_DIR)/libuClibc-* \
  467. $(1)/lib/
  468. endef
  469. LD_MUSL_NAME = $(notdir $(firstword $(wildcard $(TOOLCHAIN_DIR)/lib/libc.so*)))
  470. define Package/musl/install
  471. $(INSTALL_DIR) $(1)/lib $(1)/usr/bin
  472. $(CP) \
  473. $(TOOLCHAIN_DIR)/lib/ld-musl-*.so* \
  474. $(1)/lib/
  475. $(CP) \
  476. $(TOOLCHAIN_DIR)/lib/libc.so* \
  477. $(1)/lib/
  478. $(LN) ../../lib/$(LD_MUSL_NAME) $(1)/usr/bin/ldd
  479. endef
  480. define Package/libc/install
  481. $(call Package/$(LIBC)/install,$1)
  482. endef
  483. define Package/libc/install_lib
  484. $(CP) $(filter-out %/libdl_pic.a %/libpthread_pic.a %/libresolv_pic.a,$(wildcard $(TOOLCHAIN_DIR)/lib/lib*.a)) $(1)/lib/
  485. $(if $(wildcard $(TOOLCHAIN_DIR)/lib/libc_so.a),$(CP) $(TOOLCHAIN_DIR)/lib/libc_so.a $(1)/lib/libc_pic.a)
  486. $(if $(LIBGCC_MAP), \
  487. $(CP) $(LIBGCC_A) $(1)/lib/libgcc_s_pic.a; \
  488. $(CP) $(LIBGCC_MAP) $(1)/lib/libgcc_s_pic.map \
  489. )
  490. endef
  491. define Package/libpthread/install
  492. $(INSTALL_DIR) $(1)/lib
  493. ifneq ($(CONFIG_USE_MUSL)$(CONFIG_USE_UCLIBC),y)
  494. $(CP) \
  495. $(TOOLCHAIN_DIR)/lib/libpthread.so.* \
  496. $(TOOLCHAIN_DIR)/lib/libpthread-$(LIBC_SO_VERSION).so \
  497. $(1)/lib/
  498. endif
  499. endef
  500. define Package/libthread-db/install
  501. $(INSTALL_DIR) $(1)/lib
  502. $(CP) \
  503. $(TOOLCHAIN_DIR)/lib/libthread_db.so.* $(1)/lib
  504. ifeq ($(CONFIG_USE_UCLIBC),y)
  505. $(CP) \
  506. $(TOOLCHAIN_DIR)/lib/libthread_db-$(LIBC_SO_VERSION).so \
  507. $(1)/lib/
  508. endif
  509. endef
  510. define Package/libpthread/install_lib
  511. $(if $(wildcard $(TOOLCHAIN_DIR)/lib/libpthread_so.a),$(CP) $(TOOLCHAIN_DIR)/lib/libpthread_so.a $(1)/lib/libpthread_pic.a)
  512. endef
  513. define Package/librt/install
  514. $(INSTALL_DIR) $(1)/lib
  515. ifneq ($(CONFIG_USE_MUSL)$(CONFIG_USE_UCLIBC),y)
  516. $(CP) \
  517. $(TOOLCHAIN_DIR)/lib/librt.so.* \
  518. $(TOOLCHAIN_DIR)/lib/librt-$(LIBC_SO_VERSION).so \
  519. $(1)/lib/
  520. endif
  521. endef
  522. define Package/ldd/install
  523. $(INSTALL_DIR) $(1)/usr/bin/
  524. $(CP) $(TOOLCHAIN_DIR)/bin/ldd $(1)/usr/bin/
  525. endef
  526. define Package/ldconfig/install
  527. $(INSTALL_DIR) $(1)/sbin/
  528. $(CP) $(TOOLCHAIN_DIR)/sbin/ldconfig $(1)/sbin/
  529. endef
  530. else
  531. define Package/libgcc/install
  532. for file in $(call qstrip,$(CONFIG_LIBGCC_FILE_SPEC)); do \
  533. $(INSTALL_DIR) $(1)/lib ; \
  534. $(CP) $(call qstrip,$(CONFIG_LIBGCC_ROOT_DIR))/$$$$file $(1)/lib/ ; \
  535. done ; \
  536. exit 0
  537. endef
  538. define Package/libgfortran/install
  539. for file in $(call qstrip,$(CONFIG_LIBGFORTRAN_FILE_SPEC)); do \
  540. $(INSTALL_DIR) $(1)/lib ; \
  541. $(CP) $(call qstrip,$(CONFIG_LIBGFORTRAN_ROOT_DIR))/$$$$file $(1)/lib/ ; \
  542. done
  543. endef
  544. define Package/libssp/install
  545. for file in $(call qstrip,$(CONFIG_LIBSSP_FILE_SPEC)); do \
  546. $(INSTALL_DIR) $(1)/lib ; \
  547. $(CP) $(call qstrip,$(CONFIG_LIBSSP_ROOT_DIR))/$$$$file $(1)/lib/ ; \
  548. done ; \
  549. exit 0
  550. endef
  551. define Package/libstdcpp/install
  552. for file in $(call qstrip,$(CONFIG_LIBSTDCPP_FILE_SPEC)); do \
  553. $(INSTALL_DIR) $(1)/lib ; \
  554. $(CP) $(call qstrip,$(CONFIG_LIBSTDCPP_ROOT_DIR))/$$$$file $(1)/lib/ ; \
  555. done ; \
  556. exit 0
  557. endef
  558. define Package/libasan/install
  559. for file in $(call qstrip,$(CONFIG_LIBASAN_FILE_SPEC)); do \
  560. $(INSTALL_DIR) $(1)/lib ; \
  561. $(CP) $(call qstrip,$(CONFIG_LIBASAN_ROOT_DIR))/$$$$file $(1)/lib/ ; \
  562. done ; \
  563. exit 0
  564. endef
  565. define Package/libtsan/install
  566. for file in $(call qstrip,$(CONFIG_LIBTSAN_FILE_SPEC)); do \
  567. $(INSTALL_DIR) $(1)/lib ; \
  568. $(CP) $(call qstrip,$(CONFIG_LIBTSAN_ROOT_DIR))/$$$$file $(1)/lib/ ; \
  569. done ; \
  570. exit 0
  571. endef
  572. define Package/liblsan/install
  573. for file in $(call qstrip,$(CONFIG_LIBLSAN_FILE_SPEC)); do \
  574. $(INSTALL_DIR) $(1)/lib ; \
  575. $(CP) $(call qstrip,$(CONFIG_LIBLSAN_ROOT_DIR))/$$$$file $(1)/lib/ ; \
  576. done ; \
  577. exit 0
  578. endef
  579. define Package/libubsan/install
  580. for file in $(call qstrip,$(CONFIG_LIBUBSAN_FILE_SPEC)); do \
  581. $(INSTALL_DIR) $(1)/lib ; \
  582. $(CP) $(call qstrip,$(CONFIG_LIBUBSAN_ROOT_DIR))/$$$$file $(1)/lib/ ; \
  583. done ; \
  584. exit 0
  585. endef
  586. define Package/libc/install
  587. for file in $(call qstrip,$(CONFIG_LIBC_FILE_SPEC)); do \
  588. $(INSTALL_DIR) $(1)/lib ; \
  589. $(CP) $(call qstrip,$(CONFIG_LIBC_ROOT_DIR))/$$$$file $(1)/lib/ ; \
  590. done ; \
  591. exit 0
  592. endef
  593. define Package/libpthread/install
  594. for file in $(call qstrip,$(CONFIG_LIBPTHREAD_FILE_SPEC)); do \
  595. $(INSTALL_DIR) $(1)/lib ; \
  596. $(CP) $(call qstrip,$(CONFIG_LIBPTHREAD_ROOT_DIR))/$$$$file $(1)/lib/ ; \
  597. done ; \
  598. exit 0
  599. endef
  600. define Package/libthread-db/install
  601. for file in $(call qstrip,$(CONFIG_LIBTHREAD_DB_FILE_SPEC)); do \
  602. $(INSTALL_DIR) $(1)/lib ; \
  603. $(CP) $(call qstrip,$(CONFIG_LIBTHREAD_DB_ROOT_DIR))/$$$$file $(1)/lib/ ; \
  604. done ; \
  605. exit 0
  606. endef
  607. define Package/librt/install
  608. for file in $(call qstrip,$(CONFIG_LIBRT_FILE_SPEC)); do \
  609. $(INSTALL_DIR) $(1)/lib ; \
  610. $(CP) $(call qstrip,$(CONFIG_LIBRT_ROOT_DIR))/$$$$file $(1)/lib/ ; \
  611. done ; \
  612. exit 0
  613. endef
  614. define Package/libatomic/install
  615. for file in $(call qstrip,$(CONFIG_LIBATOMIC_FILE_SPEC)); do \
  616. $(INSTALL_DIR) $(1)/lib ; \
  617. $(CP) $(call qstrip,$(CONFIG_LIBATOMIC_ROOT_DIR))/$$$$file $(1)/lib/ ; \
  618. done ; \
  619. exit 0
  620. endef
  621. define Package/libgomp/install
  622. for file in $(call qstrip,$(CONFIG_LIBGOMP_FILE_SPEC)); do \
  623. $(INSTALL_DIR) $(1)/lib ; \
  624. $(CP) $(call qstrip,$(CONFIG_LIBGOMP_ROOT_DIR))/$$$$file $(1)/lib/ ; \
  625. done ; \
  626. exit 0
  627. endef
  628. define Package/ldd/install
  629. for file in $(call qstrip,$(CONFIG_LDD_FILE_SPEC)); do \
  630. dir=`dirname $$$$file` ; \
  631. $(INSTALL_DIR) $(1)/$$$$dir ; \
  632. $(CP) $(call qstrip,$(CONFIG_LDD_ROOT_DIR))/$$$$file $(1)/$$$$dir/ ; \
  633. done ; \
  634. exit 0
  635. endef
  636. define Package/ldconfig/install
  637. for file in $(call qstrip,$(CONFIG_LDCONFIG_FILE_SPEC)); do \
  638. dir=`dirname $$$$file` ; \
  639. $(INSTALL_DIR) $(1)/$$$$dir ; \
  640. $(CP) $(call qstrip,$(CONFIG_LDCONFIG_ROOT_DIR))/$$$$file $(1)/$$$$dir/ ; \
  641. done ; \
  642. exit 0
  643. endef
  644. endif
  645. $(eval $(call BuildPackage,libc))
  646. $(eval $(call BuildPackage,libgcc))
  647. $(eval $(call BuildPackage,libatomic))
  648. $(eval $(call BuildPackage,libssp))
  649. $(eval $(call BuildPackage,libstdcpp))
  650. $(eval $(call BuildPackage,libasan))
  651. $(eval $(call BuildPackage,libtsan))
  652. $(eval $(call BuildPackage,liblsan))
  653. $(eval $(call BuildPackage,libubsan))
  654. $(eval $(call BuildPackage,libpthread))
  655. $(eval $(call BuildPackage,libthread-db))
  656. $(eval $(call BuildPackage,librt))
  657. $(eval $(call BuildPackage,libgfortran))
  658. $(eval $(call BuildPackage,libgomp))
  659. $(eval $(call BuildPackage,ldd))
  660. $(eval $(call BuildPackage,ldconfig))