-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgenerate-pkgconfig.sh
executable file
·58 lines (54 loc) · 1.48 KB
/
generate-pkgconfig.sh
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
56
57
58
#!/bin/sh
rm -r -f txlin.pc txlin-macflags
LIBS="-pthread -DTXLIN_PTHREAD -lm -lSDL2_ttf"
CFLAGS="-pthread -DTXLIN_PTHREAD"
VERSION=1.76
touch txlin.pc
cat >>txlin.pc<<EOF
Name: TXLin
Description: TXLin is a library providing TXLib API on Linux and macOS.
Requires: sdl2
Version: $VERSION
Libs: $LIBS
Cflags: $CFLAGS
EOF
cat >>txlin-macflags<<EOF
#!/bin/sh
if test "\$1" = "--cflags"; then
echo "$CFLAGS -I/usr/local/include \$(sdl2-config --cflags)"
elif test "\$1" = "--libs"; then
echo "\$(sdl2-config --libs) $LIBS "
fi
exit 0
EOF
chmod 755 txlin-macflags
if test "$1" = "--install"; then
if test `uname` = "Darwin"; then
cp txlin-macflags /usr/local/bin/txlin-macflags
else
mkdir -p /usr/share/pkgconfig > /dev/null 2>&1
cp txlin.pc /usr/share/pkgconfig/txlin.pc
fi
if test "$?" != "0"; then
exit 1
fi
elif test "$1" = "--install-with-txlin"; then
if sh "$0" --install; then
echo "Installed pkgconfig files"
else
echo "Did not install pkgconfig files, cannot install the library itself. Maybe run \"sudo $0 $*\" (without quotes, obviously)?"
exit 2
fi
PATHD=/usr/local/include
if test `uname` != "Darwin"; then
PATHD=/usr/include
fi
mkdir -p $PATHD > /dev/null 2>&1
cp TXLin.h $PATHD/TXLin.h
if command -v sdl2-config > /dev/null 2>&1; then
echo "SDL2 found, everything should be working properly"
else
echo "WARNING! SDL2 development files were not found on your computer. Without them, TXLin won't work. Please install them before using the library."
fi
fi
exit 0