OpenSDE Packages Database (without history before r20070)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

93 lines
2.9 KiB

  1. # --- SDE-COPYRIGHT-NOTE-BEGIN ---
  2. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  3. #
  4. # Filename: package/.../musl/musl.conf
  5. # Copyright (C) 2012 - 2020 The OpenSDE Project
  6. #
  7. # More information can be found in the files COPYING and README.
  8. #
  9. # This program is free software; you can redistribute it and/or modify
  10. # it under the terms of the GNU General Public License as published by
  11. # the Free Software Foundation; version 2 of the License. A copy of the
  12. # GNU General Public License can be found in the file COPYING.
  13. # --- SDE-COPYRIGHT-NOTE-END ---
  14. # translate $arch for being usable with musl
  15. musl_arch="$( echo $arch | arch2uname )"
  16. if [ $prefix_auto == 1 ]; then
  17. syslibdir="/lib"
  18. fi
  19. var_append configprefix ' ' "LDFLAGS=\"$LDFLAGS -Wl,-soname,libc.musl-$musl_arch.so.1\""
  20. if atstage toolchain; then
  21. var_append extraconfopt ' ' "--syslibdir=$root$syslibdir"
  22. confopt="$extraconfopt"
  23. makeopt="ARCH=$musl_arch"
  24. fi
  25. musl_postinstall() {
  26. # LDSO is the be the real file, and libc the symlink.
  27. local LDSO=ld-musl-$musl_arch.so.1
  28. local LIBCSO=libc.musl-$musl_arch.so.1
  29. mv $root$libdir/libc.so $root$syslibdir/$LDSO
  30. ln -vsf $LDSO $root$syslibdir/$LIBCSO
  31. # create a libc.so symlink to avoid libtool's attempt linking shared
  32. # libs against libc.a in certain cases
  33. ln -vsf $( relative_path $root$syslibdir/$LDSO $root$libdir/libc.so ) \
  34. $root$libdir/libc.so
  35. # create a symlink from ld-musl-$musl_arch.so to ldd if the dynlinker
  36. # was started as "ldd" it will print DSO information
  37. ln -vsf $( relative_path $root$syslibdir/$LDSO $root$bindir/ldd ) \
  38. $root$bindir/ldd
  39. # make some compat links for various libraries
  40. for i in libc.so.6 libcrypt.so.1 libm.so.6 libpthread.so.0 librt.so.1 libutil.so.1; do
  41. ln -vsf $( relative_path $root$syslibdir/$LIBCSO $root$syslibdir/$i ) \
  42. $root$syslibdir/$i
  43. done
  44. }
  45. musl_make_utils() {
  46. # build minimal libssp_nonshared.a so we don't need libssp from gcc
  47. # comes from Alpine Linux
  48. gcc $CPPFLAGS $CFLAGS -c $confdir/__stack_chk_fail_local.c -o __stack_chk_fail_local.o
  49. $AR r libssp_nonshared.a __stack_chk_fail_local.o
  50. cp -a libssp_nonshared.a $root/$libdir/
  51. local i
  52. for i in getconf getent iconv ; do
  53. gcc $CPPFLAGS $CFLAGS -c $confdir/$i.c -o $i
  54. chmod +x $i
  55. cp -a $i $root/$sbindir
  56. done
  57. cp -a $confdir/ldconfig $root/$sbindir
  58. chmod +x $root/$sbindir/ldconfig
  59. }
  60. # if musl is default libc
  61. if [ "$SDECFG_LIBC" == "musl" ]; then
  62. # disable gcc wrapper script
  63. var_append extraconfopt ' ' "--disable-gcc-wrapper"
  64. if ! atstage toolchain; then
  65. hook_add postinstall 5 'musl_postinstall'
  66. fi
  67. hook_add postflist 9 "rm -rf $root/$includedir/libintl.h"
  68. hook_add postpatch 5 'musl_make_utils'
  69. fi
  70. # always install the headers even if already present in the sandbox
  71. install_headers() {
  72. touch include/*.h include/*/*.h arch/$musl_arch/*.h arch/$musl_arch/*/*.h arch/generic/*/*.h
  73. $MAKE ARCH=$musl_arch prefix=/usr DESTDIR=$sysroot install-headers
  74. }
  75. hook_add postmake 9 "install_headers"