patches and low-level development discussion
 help / color / mirror / code / Atom feed
938db10e294f4c7aeccbbb4b6c48976b247b23ba blob 1169 bytes (raw)

 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
 
#!/bin/sh

# SPDX-License-Identifier: GPL-2.0-or-later
# SPDX-FileCopyrightText: 2021 Alyssa Ross <hi@alyssa.is>

set -ue

prefix=/usr/local
bindir=

unrecognized=

for arg; do
	if [ "$arg" = "--help" ]; then
		cat <<EOF
Usage: $0 [OPTION]..."

Options:
  -h, --help
  --prefix=PREFIX         Default: /usr/local
  --bindir=BINDIR         Default: PREFIX/bin
EOF
		exit
	fi
done

for arg; do
	if printf "%s" "$arg" | grep -q "^--prefix="; then
		prefix="$(printf "%s" "$arg" | cut -d= -f2-)"
	elif printf "%s" "$arg" | grep -q "^--bindir="; then
		bindir="$(printf "%s" "$arg" | cut -d= -f2-)"
	elif printf "%s" "$arg" | grep -q "^--"; then
		unrecognized="$unrecognized $arg"
	else
		echo "Error: unexpected argument: $arg" >&2
		exit 64 # EX_USAGE
	fi
done

bindir="${bindir:-$prefix/bin}"

echo "// Generated by $0${*:+ $*}" > config.h.tmp
echo "#define PREFIX \"$prefix\"" >> config.h.tmp
echo "#define BINDIR \"$bindir\"" >> config.h.tmp
mv config.h.tmp config.h

sed -e "s#@PREFIX@#$prefix#g" -e "s#@BINDIR@#$bindir#g" Makefile.in > Makefile.tmp
mv Makefile.tmp Makefile

if [ -n "$unrecognized" ]; then
	echo "Warning: unrecognized options:$unrecognized" >&2
fi
debug log:

solving 938db10 ...
found 938db10 in https://spectrum-os.org/git/ucspi-vsock

Code repositories for project(s) associated with this public inbox

	https://spectrum-os.org/git/crosvm
	https://spectrum-os.org/git/doc
	https://spectrum-os.org/git/mktuntap
	https://spectrum-os.org/git/nixpkgs
	https://spectrum-os.org/git/spectrum
	https://spectrum-os.org/git/ucspi-vsock
	https://spectrum-os.org/git/www

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).