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