aboutsummaryrefslogtreecommitdiff
path: root/extra/efivar/build
blob: 2973fd4f80107ea82c8779eeb074882b3f3fabfa (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
#!/bin/sh -e

export LDFLAGS="$LDFLAGS -static"

mk() {
    make \
        TOPDIR=.. \
        libdir=/usr/lib/ \
        bindir=/usr/bin/ \
        mandir=/usr/share/man/ \
        includedir=/usr/include/ \
        "$@"
}

(
    cd src
    clsed '/#include <sys\/cdefs.h>/d' compiler.h

    # Build static targets.
    mk libefiboot.a libefivar.a efiboot.pc efivar.pc
    patch -p2 < ../musl-compat.patch
    mk efivar-static

    # Install the binary.
    clinst -Dm755 efivar-static "$1/usr/bin/efivar"
    
    # Install libraries.
    clinst -Dm644 libefiboot.a  "$1/usr/lib/libefiboot.a"
    clinst -Dm644 libefivar.a   "$1/usr/lib/libefivar.a"
    
    # Install pkgconf files.
    clinst -Dm644 efiboot.pc    "$1/usr/lib/pkgconfig/efiboot.pc"
    clinst -Dm644 efivar.pc     "$1/usr/lib/pkgconfig/efivar.pc"
    
    # Install headers.
    find include -type f | while read -r header; do
        clinst -Dm644 "$header" "$1/usr/$header"
    done
)


mk -C docs DESTDIR="$1" install