forked from andrewprock/ustl
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconfigure
executable file
·55 lines (42 loc) · 1.59 KB
/
configure
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
#! /bin/bash
#
# This file is free software, distributed under the MIT License.
######################################################################
#### Project Configuration ###########################################
######################################################################
PKG_NAME="ustl"
PKG_VERSTR="v2.6"
PKG_BUGREPORT="Mike Sharov <[email protected]>"
# Files that get created by this script
FILES="config.h"
# Automatic vars
[ -d .git ] && PKG_VERSTR=`git describe --always`
PKG_MAJOR=`expr "$PKG_VERSTR" : 'v\([0-9]*\)\.[0-9]*'`
PKG_MINOR=`expr "$PKG_VERSTR" : 'v[0-9]*\.\([0-9]*\)'`
PKG_STRING="$PKG_NAME $PKG_VERSTR"
# Miscellaneous substitutions
CUSTSUBS="s/@PKG_NAME@/$PKG_NAME/g
s/@PKG_VERSION@/"0x$PKG_MAJOR${PKG_MINOR}0"/g
s/@PKG_VERSTR@/$PKG_VERSTR/g
s/@PKG_STRING@/$PKG_STRING/g
s/@PKG_UNAME@/`echo $PKG_NAME|tr a-z A-Z`/g
s/@PKG_BUGREPORT@/$PKG_BUGREPORT/g
s/@PKG_MAJOR@/$PKG_MAJOR/g
s/@PKG_MINOR@/$PKG_MINOR/g"
######################################################################
#### The rest of the file is configuration code. Leave it alone. #####
######################################################################
die() { rm -f config.sed config.cpu config.cpu.c; exit; }
#### Find headers, libs, programs, and subs ##########################
echo "$CUSTSUBS" >>config.sed
#### Apply substitutions to all files ################################
for i in $FILES; do
sed -f config.sed $i.in > $i
done
touch config.status
echo "#! /bin/sh
$0 $*
`tail -n+3 config.status`" > config.status.new
chmod u+x config.status.new
mv config.status.new config.status
die