2 # Copyright (C) 2007-2014 OpenWrt.org
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
8 include $(TOPDIR
)/rules.mk
12 PKG_MAINTAINER
:=Felix Fietkau
<nbd@nbd.name
>
13 PKG_LICENSE
:=GPL-3.0
-with-GCC-exception
15 PKG_FLAGS
:=hold essential nonshared
17 include $(INCLUDE_DIR
)/package.mk
20 LIBGCC_VERSION
:=$(GCC_VERSION
)
22 LIBC_VERSION
:=<LIBC_VERSION
>
23 LIBGCC_VERSION
:=<LIBGCC_VERSION
>
26 define Package
/gcc
/Default
29 URL
:=http
://gcc.gnu.org
/
30 VERSION
:=$(LIBGCC_VERSION
)-$(PKG_RELEASE
)
34 $(call Package
/gcc
/Default
)
35 TITLE
:=GCC support library
38 define Package
/libgcc
/config
40 depends on EXTERNAL_TOOLCHAIN
&& PACKAGE_libgcc
42 config LIBGCC_ROOT_DIR
44 prompt
"libgcc shared library base directory"
45 depends on EXTERNAL_TOOLCHAIN
&& PACKAGE_libgcc
46 default TOOLCHAIN_ROOT if
!NATIVE_TOOLCHAIN
47 default
"/" if NATIVE_TOOLCHAIN
49 config LIBGCC_FILE_SPEC
51 prompt
"libgcc shared library files (use wildcards)"
52 depends on EXTERNAL_TOOLCHAIN
&& PACKAGE_libgcc
53 default
"./lib/libgcc_s.so.*"
58 define Package
/libatomic
59 $(call Package
/gcc
/Default
)
61 TITLE
:=Atomic support library
64 define Package
/libatomic
/config
66 depends on EXTERNAL_TOOLCHAIN
&& PACKAGE_libatomic
68 config LIBATOMIC_ROOT_DIR
70 prompt
"libatomic shared library base directory"
71 depends on EXTERNAL_TOOLCHAIN
&& PACKAGE_libatomic
72 default TOOLCHAIN_ROOT if
!NATIVE_TOOLCHAIN
73 default
"/" if NATIVE_TOOLCHAIN
75 config LIBATOMIC_FILE_SPEC
77 prompt
"libatomic shared library files (use wildcards)"
78 depends on EXTERNAL_TOOLCHAIN
&& PACKAGE_libatomic
79 default
"./lib/libatomic.so.*"
85 $(call Package
/gcc
/Default
)
87 TITLE
:=GCC support library
90 define Package
/libssp
/config
92 depends on EXTERNAL_TOOLCHAIN
&& PACKAGE_libssp
94 config LIBSSP_ROOT_DIR
96 prompt
"libssp shared library base directory"
97 depends on EXTERNAL_TOOLCHAIN
&& PACKAGE_libssp
98 default TOOLCHAIN_ROOT if
!NATIVE_TOOLCHAIN
99 default
"/" if NATIVE_TOOLCHAIN
101 config LIBSSP_FILE_SPEC
103 prompt
"libssp shared library files (use wildcards)"
104 depends on EXTERNAL_TOOLCHAIN
&& PACKAGE_libssp
105 default
"./lib/libssp.so.*"
111 define Package
/libstdcpp
112 $(call Package
/gcc
/Default
)
114 TITLE
:=GNU Standard C
++ Library v3
117 define Package
/libstdcpp
/config
119 depends on EXTERNAL_TOOLCHAIN
&& PACKAGE_libstdcpp
121 config LIBSTDCPP_ROOT_DIR
123 prompt
"libstdcpp shared library base directory"
124 depends on EXTERNAL_TOOLCHAIN
&& PACKAGE_libstdcpp
125 default TOOLCHAIN_ROOT if
!NATIVE_TOOLCHAIN
126 default
"/" if NATIVE_TOOLCHAIN
128 config LIBSTDCPP_FILE_SPEC
130 prompt
"libstdc++ shared library files (use wildcards)"
131 depends on EXTERNAL_TOOLCHAIN
&& PACKAGE_libstdcpp
132 default
"./lib/libstdc++.so.*"
138 define Package
/libc
/Default
140 CATEGORY
:=Base system
141 VERSION
:=$(LIBC_VERSION
)-$(PKG_RELEASE
)
148 $(call Package
/libc
/Default
)
152 define Package
/libc
/config
154 depends on EXTERNAL_TOOLCHAIN
&& PACKAGE_libc
158 prompt
"libc shared library base directory"
159 depends on EXTERNAL_TOOLCHAIN
&& PACKAGE_libc
160 default TOOLCHAIN_ROOT if
!NATIVE_TOOLCHAIN
161 default
"/" if NATIVE_TOOLCHAIN
163 config LIBC_FILE_SPEC
165 prompt
"libc shared library files (use wildcards)"
166 depends on EXTERNAL_TOOLCHAIN
&& PACKAGE_libc
167 default
"./lib/ld{*.so*,-linux*.so.*} ./lib/lib{anl,c,cidn,crypt,dl,m,nsl,nss_dns,nss_files,resolv,util}{-*.so,.so.*}"
173 define Package
/libpthread
174 $(call Package
/libc
/Default
)
175 TITLE
:=POSIX thread library
178 define Package
/libpthread
/config
180 depends on EXTERNAL_TOOLCHAIN
&& PACKAGE_libpthread
182 config LIBPTHREAD_ROOT_DIR
184 prompt
"libpthread shared library base directory"
185 depends on EXTERNAL_TOOLCHAIN
&& PACKAGE_libpthread
186 default TOOLCHAIN_ROOT if
!NATIVE_TOOLCHAIN
187 default
"/" if NATIVE_TOOLCHAIN
189 config LIBPTHREAD_FILE_SPEC
191 prompt
"libpthread shared library files (use wildcards)"
192 depends on EXTERNAL_TOOLCHAIN
&& PACKAGE_libpthread
193 default
"./lib/libpthread{-*.so,.so.*}"
199 define Package
/libthread-db
200 $(call Package
/libc
/Default
)
202 TITLE
:=POSIX thread library debugging support
205 define Package
/libthread-db
/config
207 depends on EXTERNAL_TOOLCHAIN
&& PACKAGE_libthread-db
209 config LIBTHREAD_DB_ROOT_DIR
211 prompt
"POSIX thread debugging shared library base directory"
212 depends on EXTERNAL_TOOLCHAIN
&& PACKAGE_libthread-db
213 default TOOLCHAIN_ROOT if
!NATIVE_TOOLCHAIN
214 default
"/" if NATIVE_TOOLCHAIN
216 config LIBTHREAD_DB_FILE_SPEC
218 prompt
"POSIX thread debugging shared library files (use wildcards)"
219 depends on EXTERNAL_TOOLCHAIN
&& PACKAGE_libthread-db
220 default
"./lib/libthread_db{-*.so,.so.*}"
226 $(call Package
/libc
/Default
)
227 TITLE
:=POSIX
.1b RealTime extension library
231 define Package
/librt
/config
233 depends on EXTERNAL_TOOLCHAIN
&& PACKAGE_librt
235 config LIBRT_ROOT_DIR
237 prompt
"librt shared library base directory"
238 depends on EXTERNAL_TOOLCHAIN
&& PACKAGE_librt
239 default TOOLCHAIN_ROOT if
!NATIVE_TOOLCHAIN
240 default
"/" if NATIVE_TOOLCHAIN
242 config LIBRT_FILE_SPEC
244 prompt
"librt shared library files (use wildcards)"
245 depends on EXTERNAL_TOOLCHAIN
&& PACKAGE_librt
246 default
"./lib/librt{-*.so,.so.*}"
252 define Package
/libgfortran
253 $(call Package
/gcc
/Default
)
254 TITLE
:=GFortran support library
255 DEPENDS
+=@INSTALL_GFORTRAN
258 define Package
/libgfortran
/config
260 depends on EXTERNAL_TOOLCHAIN
&& PACKAGE_libgfortran
262 config LIBGFORTRAN_ROOT_DIR
264 prompt
"libgfortran shared library base directory"
265 depends on EXTERNAL_TOOLCHAIN
&& PACKAGE_libgfortran
266 default TOOLCHAIN_ROOT if
!NATIVE_TOOLCHAIN
267 default
"/" if NATIVE_TOOLCHAIN
269 config LIBGFORTRAN_FILE_SPEC
271 prompt
"libgfortran shared library files (use wildcards)"
272 depends on EXTERNAL_TOOLCHAIN
&& PACKAGE_libgfortran
273 default
"./usr/lib/libgfortran.so.*"
279 $(call Package
/libc
/Default
)
283 TITLE
:=LDD trace utility
286 define Package
/ldd
/config
288 depends on EXTERNAL_TOOLCHAIN
&& PACKAGE_ldd
292 prompt
"ldd trace utility base directory"
293 depends on EXTERNAL_TOOLCHAIN
&& PACKAGE_ldd
294 default TOOLCHAIN_ROOT if
!NATIVE_TOOLCHAIN
295 default
"/" if NATIVE_TOOLCHAIN
299 prompt
"ldd trace utility file"
300 depends on EXTERNAL_TOOLCHAIN
&& PACKAGE_ldd
301 default
"./usr/bin/ldd"
307 define Package
/ldconfig
308 $(call Package
/libc
/Default
)
312 TITLE
:=Shared library path configuration
315 define Package
/ldconfig
/config
317 depends on EXTERNAL_TOOLCHAIN
&& PACKAGE_ldconfig
319 config LDCONFIG_ROOT_DIR
321 prompt
"ldconfig base directory"
322 depends on EXTERNAL_TOOLCHAIN
&& PACKAGE_ldconfig
323 default TOOLCHAIN_ROOT if
!NATIVE_TOOLCHAIN
324 default
"/" if NATIVE_TOOLCHAIN
326 config LDCONFIG_FILE_SPEC
328 prompt
"ldconfig file"
329 depends on EXTERNAL_TOOLCHAIN
&& PACKAGE_ldconfig
330 default
"./sbin/ldconfig"
336 mkdir
-p
$(PKG_BUILD_DIR
)
339 LIBGCC_A
=$(lastword
$(wildcard $(TOOLCHAIN_DIR
)/lib
/gcc
/*/*/libgcc_pic.a
))
340 LIBGCC_MAP
=$(lastword
$(wildcard $(TOOLCHAIN_DIR
)/lib
/gcc
/*/*/libgcc.map
))
341 LIBGCC_SO
=$(lastword
$(wildcard $(TOOLCHAIN_DIR
)/lib
/libgcc_s.so.
*))
343 define Build
/Compile
/uClibc
345 $(TOOLCHAIN_DIR
)/lib
/libuClibc-
*.so \
348 ifneq ($(LIBGCC_SO
),)
349 define Build
/Compile
/libgcc
350 $(CP
) $(LIBGCC_SO
) $(PKG_BUILD_DIR
)/
354 define Build
/Compile
/Default
355 $(call Build
/Compile
/libgcc
)
356 $(call Build
/Compile
/$(LIBC
))
358 Build
/Compile
= $(Build
/Compile
/Default
)
360 ifeq ($(CONFIG_EXTERNAL_TOOLCHAIN
),)
362 define Package
/libgcc
/install
363 $(INSTALL_DIR
) $(1)/lib
364 $(CP
) $(TOOLCHAIN_DIR
)/lib
/libgcc_s.so.
* $(1)/lib
/
367 define Package
/libatomic
/install
368 $(INSTALL_DIR
) $(1)/lib
369 $(CP
) $(TOOLCHAIN_DIR
)/lib
/libatomic.so.
* $(1)/lib
/
372 define Package
/libgfortran
/install
373 $(INSTALL_DIR
) $(1)/usr
/lib
374 $(CP
) $(TOOLCHAIN_DIR
)/lib
/libgfortran.so.
* $(1)/usr
/lib
/
377 define Package
/libssp
/install
378 $(INSTALL_DIR
) $(1)/lib
379 $(CP
) $(TOOLCHAIN_DIR
)/lib
/libssp.so.
* $(1)/lib
/
382 define Package
/libstdcpp
/install
383 $(INSTALL_DIR
) $(1)/usr
/lib
384 $(CP
) $(TOOLCHAIN_DIR
)/lib
/libstdc
++.so.
* $(1)/usr
/lib
/
387 define Package
/glibc
/install
388 $(CP
) .
/glibc-files
/* $(1)/
389 rm -f
$(1)/etc
/localtime
390 $(LN
) /tmp
/localtime
$(1)/etc
/localtime
391 $(INSTALL_DIR
) $(1)/lib
393 $(TOOLCHAIN_DIR
)/lib
/ld*.so.
* \
394 $(TOOLCHAIN_DIR
)/lib
/ld-
$(LIBC_SO_VERSION
).so \
396 for file in libanl libc libcidn libcrypt libdl libm libnsl libnss_dns libnss_files libresolv libutil
; do \
397 for file in
$(TOOLCHAIN_DIR
)/lib
/$$$$file.so.
* $(TOOLCHAIN_DIR
)/lib
/$$$$file-$(LIBC_SO_VERSION
).so
; do \
398 if
[ -e
"$$$$file" ]; then \
399 $(CP
) $$$$file $(1)/lib
/; \
405 define Package
/uClibc
/install
406 $(INSTALL_DIR
) $(1)/lib
408 $(TOOLCHAIN_DIR
)/lib
/ld*-uClibc.so.
* \
409 $(TOOLCHAIN_DIR
)/lib
/ld*-uClibc-
$(LIBC_SO_VERSION
).so \
412 $(TOOLCHAIN_DIR
)/lib
/libc.so.
* \
413 $(TOOLCHAIN_DIR
)/lib
/libuClibc-
$(LIBC_SO_VERSION
).so \
416 $(PKG_BUILD_DIR
)/libuClibc-
* \
420 LD_MUSL_NAME
= $(notdir $(firstword $(wildcard $(TOOLCHAIN_DIR
)/lib
/libc.so
*)))
422 define Package
/musl
/install
423 $(INSTALL_DIR
) $(1)/lib
$(1)/usr
/bin
425 $(TOOLCHAIN_DIR
)/lib
/ld-musl-
*.so
* \
428 $(TOOLCHAIN_DIR
)/lib
/libc.so
* \
430 $(LN
) ..
/..
/lib
/$(LD_MUSL_NAME
) $(1)/usr
/bin
/ldd
433 define Package
/libc
/install
434 $(call Package
/$(LIBC
)/install,$1)
437 define Package
/libc
/install_lib
438 $(CP
) $(filter-out %/libdl_pic.a
%/libpthread_pic.a
%/libresolv_pic.a
,$(wildcard $(TOOLCHAIN_DIR
)/lib
/lib
*.a
)) $(1)/lib
/
439 $(if
$(wildcard $(TOOLCHAIN_DIR
)/lib
/libc_so.a
),$(CP
) $(TOOLCHAIN_DIR
)/lib
/libc_so.a
$(1)/lib
/libc_pic.a
)
440 $(if
$(LIBGCC_MAP
), \
441 $(CP
) $(LIBGCC_A
) $(1)/lib
/libgcc_s_pic.a
; \
442 $(CP
) $(LIBGCC_MAP
) $(1)/lib
/libgcc_s_pic.map \
446 define Package
/libpthread
/install
447 $(INSTALL_DIR
) $(1)/lib
448 ifneq ($(CONFIG_USE_MUSL
)$(CONFIG_USE_UCLIBC
),y
)
450 $(TOOLCHAIN_DIR
)/lib
/libpthread.so.
* \
451 $(TOOLCHAIN_DIR
)/lib
/libpthread-
$(LIBC_SO_VERSION
).so \
456 define Package
/libthread-db
/install
457 $(INSTALL_DIR
) $(1)/lib
459 $(TOOLCHAIN_DIR
)/lib
/libthread_db.so.
* $(1)/lib
460 ifeq ($(CONFIG_USE_UCLIBC
),y
)
462 $(TOOLCHAIN_DIR
)/lib
/libthread_db-
$(LIBC_SO_VERSION
).so \
467 define Package
/libpthread
/install_lib
468 $(if
$(wildcard $(TOOLCHAIN_DIR
)/lib
/libpthread_so.a
),$(CP
) $(TOOLCHAIN_DIR
)/lib
/libpthread_so.a
$(1)/lib
/libpthread_pic.a
)
471 define Package
/librt
/install
472 $(INSTALL_DIR
) $(1)/lib
473 ifneq ($(CONFIG_USE_MUSL
)$(CONFIG_USE_UCLIBC
),y
)
475 $(TOOLCHAIN_DIR
)/lib
/librt.so.
* \
476 $(TOOLCHAIN_DIR
)/lib
/librt-
$(LIBC_SO_VERSION
).so \
481 define Package
/ldd
/install
482 $(INSTALL_DIR
) $(1)/usr
/bin
/
483 $(CP
) $(TOOLCHAIN_DIR
)/bin
/ldd
$(1)/usr
/bin
/
486 define Package
/ldconfig
/install
487 $(INSTALL_DIR
) $(1)/sbin
/
488 $(CP
) $(TOOLCHAIN_DIR
)/sbin
/ldconfig
$(1)/sbin
/
493 define Package
/libgcc
/install
494 for file in
$(call qstrip
,$(CONFIG_LIBGCC_FILE_SPEC
)); do \
495 $(INSTALL_DIR
) $(1)/lib
; \
496 $(CP
) $(call qstrip
,$(CONFIG_LIBGCC_ROOT_DIR
))/$$$$file $(1)/lib
/ ; \
501 define Package
/libgfortran
/install
502 for file in
$(call qstrip
,$(CONFIG_LIBGFORTRAN_FILE_SPEC
)); do \
503 $(INSTALL_DIR
) $(1)/lib
; \
504 $(CP
) $(call qstrip
,$(CONFIG_LIBGFORTRAN_ROOT_DIR
))/$$$$file $(1)/lib
/ ; \
508 define Package
/libssp
/install
509 for file in
$(call qstrip
,$(CONFIG_LIBSSP_FILE_SPEC
)); do \
510 $(INSTALL_DIR
) $(1)/lib
; \
511 $(CP
) $(call qstrip
,$(CONFIG_LIBSSP_ROOT_DIR
))/$$$$file $(1)/lib
/ ; \
516 define Package
/libstdcpp
/install
517 for file in
$(call qstrip
,$(CONFIG_LIBSTDCPP_FILE_SPEC
)); do \
518 $(INSTALL_DIR
) $(1)/lib
; \
519 $(CP
) $(call qstrip
,$(CONFIG_LIBSTDCPP_ROOT_DIR
))/$$$$file $(1)/lib
/ ; \
524 define Package
/libc
/install
525 for file in
$(call qstrip
,$(CONFIG_LIBC_FILE_SPEC
)); do \
526 $(INSTALL_DIR
) $(1)/lib
; \
527 $(CP
) $(call qstrip
,$(CONFIG_LIBC_ROOT_DIR
))/$$$$file $(1)/lib
/ ; \
532 define Package
/libpthread
/install
533 for file in
$(call qstrip
,$(CONFIG_LIBPTHREAD_FILE_SPEC
)); do \
534 $(INSTALL_DIR
) $(1)/lib
; \
535 $(CP
) $(call qstrip
,$(CONFIG_LIBPTHREAD_ROOT_DIR
))/$$$$file $(1)/lib
/ ; \
540 define Package
/libthread-db
/install
541 for file in
$(call qstrip
,$(CONFIG_LIBTHREAD_DB_FILE_SPEC
)); do \
542 $(INSTALL_DIR
) $(1)/lib
; \
543 $(CP
) $(call qstrip
,$(CONFIG_LIBTHREAD_DB_ROOT_DIR
))/$$$$file $(1)/lib
/ ; \
548 define Package
/librt
/install
549 for file in
$(call qstrip
,$(CONFIG_LIBRT_FILE_SPEC
)); do \
550 $(INSTALL_DIR
) $(1)/lib
; \
551 $(CP
) $(call qstrip
,$(CONFIG_LIBRT_ROOT_DIR
))/$$$$file $(1)/lib
/ ; \
556 define Package
/libatomic
/install
557 for file in
$(call qstrip
,$(CONFIG_LIBATOMIC_FILE_SPEC
)); do \
558 $(INSTALL_DIR
) $(1)/lib
; \
559 $(CP
) $(call qstrip
,$(CONFIG_LIBATOMIC_ROOT_DIR
))/$$$$file $(1)/lib
/ ; \
564 define Package
/ldd
/install
565 for file in
$(call qstrip
,$(CONFIG_LDD_FILE_SPEC
)); do \
566 dir=`dirname $$$$file` ; \
567 $(INSTALL_DIR
) $(1)/$$$$dir ; \
568 $(CP
) $(call qstrip
,$(CONFIG_LDD_ROOT_DIR
))/$$$$file $(1)/$$$$dir/ ; \
573 define Package
/ldconfig
/install
574 for file in
$(call qstrip
,$(CONFIG_LDCONFIG_FILE_SPEC
)); do \
575 dir=`dirname $$$$file` ; \
576 $(INSTALL_DIR
) $(1)/$$$$dir ; \
577 $(CP
) $(call qstrip
,$(CONFIG_LDCONFIG_ROOT_DIR
))/$$$$file $(1)/$$$$dir/ ; \
584 $(eval
$(call BuildPackage
,libc
))
585 $(eval
$(call BuildPackage
,libgcc
))
586 $(eval
$(call BuildPackage
,libatomic
))
587 $(eval
$(call BuildPackage
,libssp
))
588 $(eval
$(call BuildPackage
,libstdcpp
))
589 $(eval
$(call BuildPackage
,libpthread
))
590 $(eval
$(call BuildPackage
,libthread-db
))
591 $(eval
$(call BuildPackage
,librt
))
592 $(eval
$(call BuildPackage
,libgfortran
))
593 $(eval
$(call BuildPackage
,ldd
))
594 $(eval
$(call BuildPackage
,ldconfig
))