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

Commit

Permalink
try out redo as alternative build system.
Browse files Browse the repository at this point in the history
  • Loading branch information
akrennmair committed Jan 14, 2011
1 parent 49e7cc8 commit 4e2b7a7
Show file tree
Hide file tree
Showing 20 changed files with 156 additions and 0 deletions.
75 changes: 75 additions & 0 deletions _conf.sh.do
@@ -0,0 +1,75 @@
echo "CXX=c++"
echo "CXXFLAGS=\"-Wall -Wextra -ggdb -DLOCALEDIR=\\\"$localedir\\\"\""
echo "LDFLAGS=-L."

FAILSTATUS=""
CXXFLAGS=""
LDFLAGS=""

check_pkg() {
pkgname=$1
pkgconfig_args=$2
echo -n "Checking for package ${pkgname}... " >&2
if pkg-config --silence-errors "${pkgname}" ; then
echo "found" >&2
CXXFLAGS="$CXXFLAGS `pkg-config --cflags $pkgconfig_args ${pkgname}`"
LDFLAGS="$LDFLAGS `pkg-config --libs $pkgconfig_args ${pkgname}`"
else
echo "not found" >&2
return 1
fi
return 0
}

check_custom() {
pkgname=$1
customconfig=$2
echo -n "Checking for package ${pkgname} using ${customconfig}... " >&2
if ${customconfig} --cflags > /dev/null 2>&1 ; then
echo "found" >&2
CXXFLAGS="$CXXFLAGS `${customconfig} --cflags $pkgconfig_args ${pkgname}`"
LDFLAGS="$LDFLAGS `${customconfig} --libs $pkgconfig_args ${pkgname}`"
else
echo "not found" >&2
return 1
fi
return 0
}

fail() {
pkgname=$1
rm -f config.mk
dlurl=`grep -i "$pkgname" README | awk '{ print $NF }'`
echo "" >&2
echo "You need package ${pkgname} in order to compile this program." >&2
echo "Please make sure it is installed." >&2
echo "" >&2
echo "You can download ${pkgname} from here: ${dlurl}" >&2
FAILSTATUS="1"
}

fail_custom() {
err=$1
echo "" >&2
echo "ERROR: ${err}" >&2
FAILSTATUS="1"
}

all_aboard_the_fail_boat() {
if [ "x$FAILSTATUS" != "x" ] ; then
rm -f config.mk
echo "" >&2
echo "One or more dependencies couldn\'t be found. Please install" >&2
echo "these packages and retry compilation." >&2
exit 1
fi
}

check_pkg "sqlite3" || fail "sqlite3"
check_pkg "libcurl" || check_custom "libcurl" "curl-config" || fail "libcurl"
check_pkg "libxml-2.0" || check_custom "libxml2" "xml2-config" || fail "libxml2"
check_pkg "stfl" "--static" || fail "stfl"
all_aboard_the_fail_boat

echo "CXXFLAGS=\"\$CXXFLAGS $CXXFLAGS\""
echo "LDFLAGS=\"\$LDFLAGS $LDFLAGS\""
2 changes: 2 additions & 0 deletions all.do
@@ -0,0 +1,2 @@
redo-ifchange _conf.sh
redo-ifchange newsbeuter podbeuter
2 changes: 2 additions & 0 deletions clean.do
@@ -0,0 +1,2 @@
rm -f *.o *.a xlicense.h newsbeuter podbeuter _conf.sh
redo rss/clean filter/clean src/clean stfl/clean po/clean
4 changes: 4 additions & 0 deletions default.o.do
@@ -0,0 +1,4 @@
redo-ifchange _conf.sh
. ./_conf.sh

$CXX $CXXFLAGS -Iinclude -Istfl -Ifilter -I. -Irss -o $3 -c $1.cpp
1 change: 1 addition & 0 deletions filter/clean.do
@@ -0,0 +1 @@
rm -f *.o
4 changes: 4 additions & 0 deletions filter/default.o.do
@@ -0,0 +1,4 @@
redo-ifchange ../_conf.sh
. ../_conf.sh

$CXX $CXXFLAGS -I../include -I../stfl -I../filter -I.. -I../rss -o $3 -c $1.cpp
10 changes: 10 additions & 0 deletions libbeuter.a.do
@@ -0,0 +1,10 @@
redo-ifchange _conf.sh
. ./_conf.sh

OBJS=`cat libbeuter.deps | sed 's/.cpp/.o/g'`

redo-ifchange $OBJS

rm -f $1
ar qc $3 $OBJS
ranlib $3
10 changes: 10 additions & 0 deletions libfilter.a.do
@@ -0,0 +1,10 @@
redo-ifchange _conf.sh
. ./_conf.sh

OBJS="filter/Scanner.o filter/Parser.o filter/FilterParser.o"

redo-ifchange $OBJS

rm -f $1
ar qc $3 $OBJS
ranlib $3
10 changes: 10 additions & 0 deletions librsspp.a.do
@@ -0,0 +1,10 @@
redo-ifchange _conf.sh
. ./_conf.sh

RSSPPLIB_OBJS=`ls rss/*.cpp | sed 's/.cpp/.o/g'`
redo-ifchange $RSSPPLIB_OBJS
rm -f $1
ar qc $3 $RSSPPLIB_OBJS
ranlib $3
10 changes: 10 additions & 0 deletions newsbeuter.do
@@ -0,0 +1,10 @@
redo-ifchange _conf.sh
. ./_conf.sh

NEWSBEUTER_LIBS="-lbeuter -lfilter -lpthread -lrsspp"
MOFILES=`ls po/*.po | sed 's/.po/.mo/g'`
NEWSBEUTER_OBJS=`cat newsbeuter.deps | sed 's/.cpp/.o/g'`
LIBS="libbeuter.a librsspp.a libfilter.a"
redo-ifchange $MOFILES $NEWSBEUTER_OBJS $LIBS
$CXX $CXXFLAGS -Iinclude -Istfl -Ifilter -I. -Irss -o $3 $NEWSBEUTER_OBJS $NEWSBEUTER_LIBS $LDFLAGS
1 change: 1 addition & 0 deletions po/clean.do
@@ -0,0 +1 @@
rm -f *.mo
1 change: 1 addition & 0 deletions po/default.mo.do
@@ -0,0 +1 @@
msgfmt --statistics -o $3 $1.po
9 changes: 9 additions & 0 deletions podbeuter.do
@@ -0,0 +1,9 @@
redo-ifchange _conf.sh
. ./_conf.sh

PODBEUTER_LIBS="-lbeuter -lpthread"
PODBEUTER_OBJS=`cat podbeuter.deps | sed 's/.cpp/.o/g'`
LIBS="libbeuter.a"

redo-ifchange $MODFILES $PODBEUTER_OBJS $LIBS
$CXX $CXXFLAGS -Iinclude -Istfl -Ifilter -I. -Irss -o $3 $PODBEUTER_OBJS $PODBEUTER_LIBS $LDFLAGS
1 change: 1 addition & 0 deletions rss/clean.do
@@ -0,0 +1 @@
rm -f *.o
4 changes: 4 additions & 0 deletions rss/default.o.do
@@ -0,0 +1,4 @@
redo-ifchange ../_conf.sh
. ../_conf.sh

$CXX $CXXFLAGS -I../include -I../stfl -I../filter -I.. -I../rss -o $3 -c $1.cpp
1 change: 1 addition & 0 deletions src/clean.do
@@ -0,0 +1 @@
rm -f *.o
8 changes: 8 additions & 0 deletions src/default.o.do
@@ -0,0 +1,8 @@
redo-ifchange ../_conf.sh
. ../_conf.sh

# TODO: moves this to an own view.o.do file as soon as redo can handle this correctly.
STFLHDRS=`ls ../stfl/*.stfl | sed 's/.stfl$/.h/g'`
redo-ifchange $STFLHDRS ../xlicense.h
$CXX $CXXFLAGS -I../include -I../stfl -I../filter -I.. -I../rss -o $3 -c $1.cpp
1 change: 1 addition & 0 deletions stfl/clean.do
@@ -0,0 +1 @@
rm -f *.h
1 change: 1 addition & 0 deletions stfl/default.h.do
@@ -0,0 +1 @@
../txt2h.pl $1.stfl .stfl > $3
1 change: 1 addition & 0 deletions xlicense.h.do
@@ -0,0 +1 @@
./txt2h.pl LICENSE > $3

0 comments on commit 4e2b7a7

Please sign in to comment.