aboutsummaryrefslogtreecommitdiff
path: root/extra/efivar/build
blob: 43b2291f32d81cc3c897aefbfe01c8be6e40beed (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
#!/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
    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