2020-02-07 04:49:27 +00:00
|
|
|
#!/bin/sh
|
|
|
|
set -eu
|
|
|
|
|
2020-07-23 20:28:38 +00:00
|
|
|
cflags() {
|
|
|
|
echo "CFLAGS += $*"
|
|
|
|
}
|
|
|
|
ldlibs() {
|
|
|
|
echo "LDLIBS ${o:-}= $*"
|
|
|
|
o=+
|
|
|
|
}
|
|
|
|
config() {
|
|
|
|
pkg-config --print-errors "$@"
|
|
|
|
cflags $(pkg-config --cflags "$@")
|
|
|
|
ldlibs $(pkg-config --libs "$@")
|
|
|
|
}
|
|
|
|
defstr() {
|
|
|
|
cflags "-D'$1=\"$2\"'"
|
|
|
|
}
|
|
|
|
defvar() {
|
|
|
|
defstr "$1" "$(pkg-config --variable=$3 $2)${4:-}"
|
|
|
|
}
|
2020-06-11 20:06:01 +00:00
|
|
|
|
2020-07-23 20:28:38 +00:00
|
|
|
exec >config.mk
|
2020-02-12 00:03:39 +00:00
|
|
|
|
2020-07-23 20:28:38 +00:00
|
|
|
case "$(uname)" in
|
|
|
|
(FreeBSD)
|
|
|
|
ldlibs -lncursesw
|
|
|
|
config libtls
|
|
|
|
defvar OPENSSL_BIN openssl exec_prefix /bin/openssl
|
|
|
|
;;
|
|
|
|
(OpenBSD)
|
|
|
|
ldlibs -lncursesw -ltls
|
|
|
|
defstr OPENSSL_BIN /usr/bin/openssl
|
|
|
|
;;
|
|
|
|
(Linux)
|
|
|
|
cflags -Wno-pedantic -D_GNU_SOURCE
|
|
|
|
config libcrypto libtls ncursesw
|
|
|
|
defvar OPENSSL_BIN openssl exec_prefix /bin/openssl
|
|
|
|
;;
|
|
|
|
(*)
|
|
|
|
config libcrypto libtls ncursesw
|
|
|
|
defvar OPENSSL_BIN openssl exec_prefix /bin/openssl
|
|
|
|
;;
|
|
|
|
esac
|