123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105 |
- # Build recipe for musl.
- #
- # Copyright (c) 2015-2018 Matias Fonzo, <selk@dragora.org>.
- #
- # Licensed under the Apache License, Version 2.0 (the "License");
- # you may not use this file except in compliance with the License.
- # You may obtain a copy of the License at
- #
- # http://www.apache.org/licenses/LICENSE-2.0
- #
- # Unless required by applicable law or agreed to in writing, software
- # distributed under the License is distributed on an "AS IS" BASIS,
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- # See the License for the specific language governing permissions and
- # limitations under the License.
- program=musl
- version=1.1.19
- release=1
- tarname=${program}-${version}.tar.gz
- # Remote source(s)
- fetch=http://www.musl-libc.org/releases/$tarname
- description="
- A powerful standard C/POSIX library.
- Musl is a new standard library to power a new generation of Linux-based
- devices. Musl is lightweight, fast, simple, free, and strives to be
- correct in the sense of standards-conformance and safety.
- "
- homepage=http://www.musl-libc.org
- license=MIT
- # Source documentation
- docs="COPYRIGHT README VERSION WHATSNEW"
- docsdir="${docdir}/${program}-${version}"
- build()
- {
- set -e
- unpack "${tardir}/$tarname"
- cd "$srcdir"
- patch -Np0 -i "${worktree}/patches/musl/musl-utmp_path.diff"
- # Do not use the compiler runtime library from the temporary system,
- # the toolchain must be adjusted until the native GCC take place
- if cc -print-libgcc-file-name | grep -q '^/tools'
- then
- patch -Np1 -i "${worktree}/patches/musl/musl-nolibcc_stage1.diff"
- fi
- # Some tune options for i586, x86_64
- patch -Np1 -i "${worktree}/patches/musl/musl-tune.diff"
- ./configure $configure_args \
- --libdir=/usr/lib${libSuffix} \
- --syslibdir=/lib \
- --enable-shared \
- --enable-static \
- --enable-optimize=size
- make -j${jobs}
- make -j${jobs} install DESTDIR="$destdir"
- # To print shared library dependencies
- mkdir -p "${destdir}/usr/bin"
- ln -sf /usr/lib${libSuffix}/libc.so "${destdir}/usr/bin/ldd"
- # Create dynamic linker runtime file taking -$(ARCH) as reference
- for file in "${destdir}"/lib/ld-musl-*.so.1
- do
- if ls -1 "$file" > /dev/null
- then
- ld_path="${file##*/}" # Basename
- ld_path="${ld_path%%.*}.path" # Get the rid of .so.1
- break;
- fi
- done
- unset file
- if test -n "$ld_path"
- then
- mkdir -p "${destdir}/etc"
- cat << EOF > "${destdir}/etc/$ld_path"
- /lib
- /usr/local/lib
- /usr/lib
- /usr/$(cc -dumpmachine)/lib
- EOF
- chmod 644 "${destdir}/etc/$ld_path"
- touch "${destdir}/etc/.graft-config"
- fi
- # Copy documentation
- mkdir -p "${destdir}${docsdir}"
- cp -p $docs "${destdir}${docsdir}"
- }
|