Skip to content
This repository was archived by the owner on Oct 10, 2019. It is now read-only.

Commit 4e2b7a7

Browse files
committed
try out redo as alternative build system.
1 parent 49e7cc8 commit 4e2b7a7

20 files changed

+156
-0
lines changed

_conf.sh.do

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
echo "CXX=c++"
2+
echo "CXXFLAGS=\"-Wall -Wextra -ggdb -DLOCALEDIR=\\\"$localedir\\\"\""
3+
echo "LDFLAGS=-L."
4+
5+
FAILSTATUS=""
6+
CXXFLAGS=""
7+
LDFLAGS=""
8+
9+
check_pkg() {
10+
pkgname=$1
11+
pkgconfig_args=$2
12+
echo -n "Checking for package ${pkgname}... " >&2
13+
if pkg-config --silence-errors "${pkgname}" ; then
14+
echo "found" >&2
15+
CXXFLAGS="$CXXFLAGS `pkg-config --cflags $pkgconfig_args ${pkgname}`"
16+
LDFLAGS="$LDFLAGS `pkg-config --libs $pkgconfig_args ${pkgname}`"
17+
else
18+
echo "not found" >&2
19+
return 1
20+
fi
21+
return 0
22+
}
23+
24+
check_custom() {
25+
pkgname=$1
26+
customconfig=$2
27+
echo -n "Checking for package ${pkgname} using ${customconfig}... " >&2
28+
if ${customconfig} --cflags > /dev/null 2>&1 ; then
29+
echo "found" >&2
30+
CXXFLAGS="$CXXFLAGS `${customconfig} --cflags $pkgconfig_args ${pkgname}`"
31+
LDFLAGS="$LDFLAGS `${customconfig} --libs $pkgconfig_args ${pkgname}`"
32+
else
33+
echo "not found" >&2
34+
return 1
35+
fi
36+
return 0
37+
}
38+
39+
fail() {
40+
pkgname=$1
41+
rm -f config.mk
42+
dlurl=`grep -i "$pkgname" README | awk '{ print $NF }'`
43+
echo "" >&2
44+
echo "You need package ${pkgname} in order to compile this program." >&2
45+
echo "Please make sure it is installed." >&2
46+
echo "" >&2
47+
echo "You can download ${pkgname} from here: ${dlurl}" >&2
48+
FAILSTATUS="1"
49+
}
50+
51+
fail_custom() {
52+
err=$1
53+
echo "" >&2
54+
echo "ERROR: ${err}" >&2
55+
FAILSTATUS="1"
56+
}
57+
58+
all_aboard_the_fail_boat() {
59+
if [ "x$FAILSTATUS" != "x" ] ; then
60+
rm -f config.mk
61+
echo "" >&2
62+
echo "One or more dependencies couldn\'t be found. Please install" >&2
63+
echo "these packages and retry compilation." >&2
64+
exit 1
65+
fi
66+
}
67+
68+
check_pkg "sqlite3" || fail "sqlite3"
69+
check_pkg "libcurl" || check_custom "libcurl" "curl-config" || fail "libcurl"
70+
check_pkg "libxml-2.0" || check_custom "libxml2" "xml2-config" || fail "libxml2"
71+
check_pkg "stfl" "--static" || fail "stfl"
72+
all_aboard_the_fail_boat
73+
74+
echo "CXXFLAGS=\"\$CXXFLAGS $CXXFLAGS\""
75+
echo "LDFLAGS=\"\$LDFLAGS $LDFLAGS\""

all.do

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
redo-ifchange _conf.sh
2+
redo-ifchange newsbeuter podbeuter

clean.do

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
rm -f *.o *.a xlicense.h newsbeuter podbeuter _conf.sh
2+
redo rss/clean filter/clean src/clean stfl/clean po/clean

default.o.do

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
redo-ifchange _conf.sh
2+
. ./_conf.sh
3+
4+
$CXX $CXXFLAGS -Iinclude -Istfl -Ifilter -I. -Irss -o $3 -c $1.cpp

filter/clean.do

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
rm -f *.o

filter/default.o.do

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
redo-ifchange ../_conf.sh
2+
. ../_conf.sh
3+
4+
$CXX $CXXFLAGS -I../include -I../stfl -I../filter -I.. -I../rss -o $3 -c $1.cpp

libbeuter.a.do

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
redo-ifchange _conf.sh
2+
. ./_conf.sh
3+
4+
OBJS=`cat libbeuter.deps | sed 's/.cpp/.o/g'`
5+
6+
redo-ifchange $OBJS
7+
8+
rm -f $1
9+
ar qc $3 $OBJS
10+
ranlib $3

libfilter.a.do

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
redo-ifchange _conf.sh
2+
. ./_conf.sh
3+
4+
OBJS="filter/Scanner.o filter/Parser.o filter/FilterParser.o"
5+
6+
redo-ifchange $OBJS
7+
8+
rm -f $1
9+
ar qc $3 $OBJS
10+
ranlib $3

librsspp.a.do

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
redo-ifchange _conf.sh
2+
. ./_conf.sh
3+
4+
RSSPPLIB_OBJS=`ls rss/*.cpp | sed 's/.cpp/.o/g'`
5+
6+
redo-ifchange $RSSPPLIB_OBJS
7+
8+
rm -f $1
9+
ar qc $3 $RSSPPLIB_OBJS
10+
ranlib $3

newsbeuter.do

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
redo-ifchange _conf.sh
2+
. ./_conf.sh
3+
4+
NEWSBEUTER_LIBS="-lbeuter -lfilter -lpthread -lrsspp"
5+
MOFILES=`ls po/*.po | sed 's/.po/.mo/g'`
6+
NEWSBEUTER_OBJS=`cat newsbeuter.deps | sed 's/.cpp/.o/g'`
7+
LIBS="libbeuter.a librsspp.a libfilter.a"
8+
9+
redo-ifchange $MOFILES $NEWSBEUTER_OBJS $LIBS
10+
$CXX $CXXFLAGS -Iinclude -Istfl -Ifilter -I. -Irss -o $3 $NEWSBEUTER_OBJS $NEWSBEUTER_LIBS $LDFLAGS

po/clean.do

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
rm -f *.mo

po/default.mo.do

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
msgfmt --statistics -o $3 $1.po

podbeuter.do

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
redo-ifchange _conf.sh
2+
. ./_conf.sh
3+
4+
PODBEUTER_LIBS="-lbeuter -lpthread"
5+
PODBEUTER_OBJS=`cat podbeuter.deps | sed 's/.cpp/.o/g'`
6+
LIBS="libbeuter.a"
7+
8+
redo-ifchange $MODFILES $PODBEUTER_OBJS $LIBS
9+
$CXX $CXXFLAGS -Iinclude -Istfl -Ifilter -I. -Irss -o $3 $PODBEUTER_OBJS $PODBEUTER_LIBS $LDFLAGS

rss/clean.do

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
rm -f *.o

rss/default.o.do

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
redo-ifchange ../_conf.sh
2+
. ../_conf.sh
3+
4+
$CXX $CXXFLAGS -I../include -I../stfl -I../filter -I.. -I../rss -o $3 -c $1.cpp

src/clean.do

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
rm -f *.o

src/default.o.do

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
redo-ifchange ../_conf.sh
2+
. ../_conf.sh
3+
4+
# TODO: moves this to an own view.o.do file as soon as redo can handle this correctly.
5+
STFLHDRS=`ls ../stfl/*.stfl | sed 's/.stfl$/.h/g'`
6+
redo-ifchange $STFLHDRS ../xlicense.h
7+
8+
$CXX $CXXFLAGS -I../include -I../stfl -I../filter -I.. -I../rss -o $3 -c $1.cpp

stfl/clean.do

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
rm -f *.h

stfl/default.h.do

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../txt2h.pl $1.stfl .stfl > $3

xlicense.h.do

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
./txt2h.pl LICENSE > $3

0 commit comments

Comments
 (0)