summaryrefslogtreecommitdiff
path: root/pkg/elftoolchain/gen.lua
blob: 7ee4e924b6e03e54b4fa036f51e02c7f970a7703 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
cflags{
	'-Wall', '-Wpedantic',
	'-I $outdir/include',
	'-I $srcdir/common',
	'-I $srcdir/libelf',
	'-isystem $builddir/pkg/openbsd/include',
}

pkg.hdrs = {
	copy('$outdir/include', '$srcdir/libelf', {'libelf.h', 'gelf.h'}),
	copy('$outdir/include', '$srcdir/common', {'elfdefinitions.h'}),
	'$outdir/include/sys/elfdefinitions.h',
	install=true,
}
pkg.deps = {'$gendir/headers', 'pkg/openbsd/headers'}

rule('m4', 'm4 $m4flags -D SRCDIR=$srcdir/libelf $in >$out')
build('m4', '$outdir/libelf_convert.c', {'$srcdir/libelf/libelf_convert.m4', '|', '$srcdir/libelf/elf_types.m4'})
build('m4', '$outdir/libelf_fsize.c', {'$srcdir/libelf/libelf_fsize.m4', '|', '$srcdir/libelf/elf_types.m4'})
build('m4', '$outdir/libelf_msize.c', {'$srcdir/libelf/libelf_msize.m4', '|', '$srcdir/libelf/elf_types.m4'})
build('m4', '$outdir/include/sys/elfdefinitions.h', {'$srcdir/common/sys/elfdefinitions.m4', '|', '$srcdir/common/sys/elfconstants.m4'}, {
	m4flags='-I $srcdir/common/sys'
})

lib('libelf.a', [[
	libelf/(
		elf.c
		elf_begin.c
		elf_cntl.c
		elf_end.c elf_errmsg.c elf_errno.c
		elf_data.c
		elf_fill.c
		elf_flag.c
		elf_getarhdr.c
		elf_getarsym.c
		elf_getbase.c
		elf_getident.c
		elf_getversion.c
		elf_hash.c
		elf_kind.c
		elf_memory.c
		elf_next.c
		elf_open.c
		elf_rand.c
		elf_rawfile.c
		elf_phnum.c
		elf_shnum.c
		elf_shstrndx.c
		elf_scn.c
		elf_strptr.c
		elf_update.c
		elf_version.c
		gelf_cap.c
		gelf_checksum.c
		gelf_dyn.c
		gelf_ehdr.c
		gelf_getclass.c
		gelf_fsize.c
		gelf_move.c
		gelf_phdr.c
		gelf_rel.c
		gelf_rela.c
		gelf_shdr.c
		gelf_sym.c
		gelf_syminfo.c
		gelf_symshndx.c
		gelf_xlate.c
		libelf_align.c
		libelf_allocate.c
		libelf_ar.c
		libelf_ar_util.c
		libelf_checksum.c
		libelf_data.c
		libelf_ehdr.c
		libelf_elfmachine.c
		libelf_extended.c
		libelf_memory.c
		libelf_open.c
		libelf_phdr.c
		libelf_shdr.c
		libelf_xlate.c
	)
	$outdir/(libelf_convert.c libelf_fsize.c libelf_msize.c)
]])
file('lib/libelf.a', '644', '$outdir/libelf.a')

fetch 'git'