commit: 39cfefa0b6034e45191d4408aa1b54860fa4fdaa
parent 40955cacd1ac929f54180dd4b0aa072aee9883a6
Author: Michael Forney <mforney@mforney.org>
Date: Wed, 11 Dec 2019 12:01:53 -0800
musl: Install headers and rest of crt files
Diffstat:
M | pkg/musl/base.lua | 186 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
M | pkg/musl/gen.lua | 45 | +++++++++++++++++++++++++++++++++++---------- |
2 files changed, 221 insertions(+), 10 deletions(-)
diff --git a/pkg/musl/base.lua b/pkg/musl/base.lua
@@ -1326,6 +1326,192 @@ return {
'src/unistd/write.c',
'src/unistd/writev.c',
},
+ hdrs={
+ -- <cd src/include && printf "\t\t'%s',\n" *.h */*.h
+ 'aio.h',
+ 'alloca.h',
+ 'ar.h',
+ 'assert.h',
+ 'byteswap.h',
+ 'complex.h',
+ 'cpio.h',
+ 'crypt.h',
+ 'ctype.h',
+ 'dirent.h',
+ 'dlfcn.h',
+ 'elf.h',
+ 'endian.h',
+ 'err.h',
+ 'errno.h',
+ 'fcntl.h',
+ 'features.h',
+ 'fenv.h',
+ 'float.h',
+ 'fmtmsg.h',
+ 'fnmatch.h',
+ 'ftw.h',
+ 'getopt.h',
+ 'glob.h',
+ 'grp.h',
+ 'iconv.h',
+ 'ifaddrs.h',
+ 'inttypes.h',
+ 'iso646.h',
+ 'langinfo.h',
+ 'lastlog.h',
+ 'libgen.h',
+ 'libintl.h',
+ 'limits.h',
+ 'link.h',
+ 'locale.h',
+ 'malloc.h',
+ 'math.h',
+ 'memory.h',
+ 'mntent.h',
+ 'monetary.h',
+ 'mqueue.h',
+ 'netdb.h',
+ 'nl_types.h',
+ 'paths.h',
+ 'poll.h',
+ 'pthread.h',
+ 'pty.h',
+ 'pwd.h',
+ 'regex.h',
+ 'resolv.h',
+ 'sched.h',
+ 'search.h',
+ 'semaphore.h',
+ 'setjmp.h',
+ 'shadow.h',
+ 'signal.h',
+ 'spawn.h',
+ 'stdalign.h',
+ 'stdarg.h',
+ 'stdbool.h',
+ 'stdc-predef.h',
+ 'stddef.h',
+ 'stdint.h',
+ 'stdio.h',
+ 'stdio_ext.h',
+ 'stdlib.h',
+ 'stdnoreturn.h',
+ 'string.h',
+ 'strings.h',
+ 'stropts.h',
+ 'syscall.h',
+ 'sysexits.h',
+ 'syslog.h',
+ 'tar.h',
+ 'termios.h',
+ 'tgmath.h',
+ 'threads.h',
+ 'time.h',
+ 'uchar.h',
+ 'ucontext.h',
+ 'ulimit.h',
+ 'unistd.h',
+ 'utime.h',
+ 'utmp.h',
+ 'utmpx.h',
+ 'values.h',
+ 'wait.h',
+ 'wchar.h',
+ 'wctype.h',
+ 'wordexp.h',
+ 'arpa/ftp.h',
+ 'arpa/inet.h',
+ 'arpa/nameser.h',
+ 'arpa/nameser_compat.h',
+ 'arpa/telnet.h',
+ 'arpa/tftp.h',
+ 'net/ethernet.h',
+ 'net/if.h',
+ 'net/if_arp.h',
+ 'net/route.h',
+ 'netinet/ether.h',
+ 'netinet/icmp6.h',
+ 'netinet/if_ether.h',
+ 'netinet/igmp.h',
+ 'netinet/in.h',
+ 'netinet/in_systm.h',
+ 'netinet/ip.h',
+ 'netinet/ip6.h',
+ 'netinet/ip_icmp.h',
+ 'netinet/tcp.h',
+ 'netinet/udp.h',
+ 'netpacket/packet.h',
+ 'scsi/scsi.h',
+ 'scsi/scsi_ioctl.h',
+ 'scsi/sg.h',
+ 'sys/acct.h',
+ 'sys/auxv.h',
+ 'sys/cachectl.h',
+ 'sys/dir.h',
+ 'sys/epoll.h',
+ 'sys/errno.h',
+ 'sys/eventfd.h',
+ 'sys/fanotify.h',
+ 'sys/fcntl.h',
+ 'sys/file.h',
+ 'sys/fsuid.h',
+ 'sys/inotify.h',
+ 'sys/io.h',
+ 'sys/ioctl.h',
+ 'sys/ipc.h',
+ 'sys/kd.h',
+ 'sys/klog.h',
+ 'sys/membarrier.h',
+ 'sys/mman.h',
+ 'sys/mount.h',
+ 'sys/msg.h',
+ 'sys/mtio.h',
+ 'sys/param.h',
+ 'sys/personality.h',
+ 'sys/poll.h',
+ 'sys/prctl.h',
+ 'sys/procfs.h',
+ 'sys/ptrace.h',
+ 'sys/quota.h',
+ 'sys/random.h',
+ 'sys/reboot.h',
+ 'sys/reg.h',
+ 'sys/resource.h',
+ 'sys/select.h',
+ 'sys/sem.h',
+ 'sys/sendfile.h',
+ 'sys/shm.h',
+ 'sys/signal.h',
+ 'sys/signalfd.h',
+ 'sys/socket.h',
+ 'sys/soundcard.h',
+ 'sys/stat.h',
+ 'sys/statfs.h',
+ 'sys/statvfs.h',
+ 'sys/stropts.h',
+ 'sys/swap.h',
+ 'sys/syscall.h',
+ 'sys/sysinfo.h',
+ 'sys/syslog.h',
+ 'sys/sysmacros.h',
+ 'sys/termios.h',
+ 'sys/time.h',
+ 'sys/timeb.h',
+ 'sys/timerfd.h',
+ 'sys/times.h',
+ 'sys/timex.h',
+ 'sys/ttydefaults.h',
+ 'sys/types.h',
+ 'sys/ucontext.h',
+ 'sys/uio.h',
+ 'sys/un.h',
+ 'sys/user.h',
+ 'sys/utsname.h',
+ 'sys/vfs.h',
+ 'sys/vt.h',
+ 'sys/wait.h',
+ 'sys/xattr.h',
+ },
bits={
-- <cd src/arch/generic/bits && printf "\t\t'%s',\n" *.h
'errno.h',
diff --git a/pkg/musl/gen.lua b/pkg/musl/gen.lua
@@ -7,10 +7,34 @@ cflags{
'-I $outdir',
'-I $srcdir/src/include',
'-I $srcdir/src/internal',
- '-I $srcdir/include',
'-I $outdir/include',
}
+local basefiles = load('base.lua')
+local archfiles = load(arch..'.lua')
+
+local bits = {}
+for _, hdr in ipairs(archfiles.bits) do
+ archfiles.bits[hdr] = true
+end
+for _, hdr in ipairs(basefiles.bits) do
+ if not archfiles.bits[hdr] then
+ table.insert(bits, hdr)
+ end
+end
+
+pkg.hdrs = {
+ copy('$outdir/include', '$srcdir/include', basefiles.hdrs),
+ copy('$outdir/include/bits', '$srcdir/arch/'..arch..'/bits', archfiles.bits),
+ copy('$outdir/include/bits', '$srcdir/arch/generic/bits', bits),
+ '$outdir/include/bits/alltypes.h',
+ '$outdir/include/bits/syscall.h',
+}
+pkg.deps = {
+ '$dir/headers',
+ '$outdir/version.h',
+}
+
build('sed', '$outdir/include/bits/alltypes.h', {
'$srcdir/arch/'..arch..'/bits/alltypes.h.in',
'$srcdir/include/alltypes.h.in',
@@ -23,15 +47,6 @@ build('sed', '$outdir/include/bits/syscall.h', {'$srcdir/arch/'..arch..'/bits/sy
build('awk', '$outdir/version.h', '$dir/ver', {expr=[['{printf "#define VERSION \"%s\"\n", $$1}']]})
-pkg.deps = {
- '$outdir/include/bits/alltypes.h',
- '$outdir/include/bits/syscall.h',
- '$outdir/version.h',
-}
-
-local basefiles = load('base.lua')
-local archfiles = load(arch..'.lua')
-
local srcmap, srcs = {}, {}
for src in iterstrings{basefiles.srcs, archfiles.srcs} do
srcmap[src:match('(.*)%.'):gsub('/'..arch..'/', '/', 1)] = src
@@ -42,6 +57,16 @@ end
lib('libc.a', srcs)
build('cc', '$outdir/crt1.o', '$srcdir/crt/crt1.c')
+build('cc', '$outdir/crti.o', '$srcdir/crt/crti.c')
+build('cc', '$outdir/crtn.o', '$srcdir/crt/crtn.c')
build('cc', '$outdir/rcrt1.o', '$srcdir/crt/rcrt1.c', {cflags='$cflags -fPIC'})
+phony('startfiles', {
+ '$outdir/libc.a',
+ '$outdir/crt1.o',
+ '$outdir/crti.o',
+ '$outdir/crtn.o',
+ '$outdir/rcrt1.o',
+})
+
fetch 'git'