Makefile 20 KB

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