Makefile 19 KB

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