From c36df67f4cc47b5dab5278d6e3b4b5a9eee34fd4 Mon Sep 17 00:00:00 2001 From: "p.kosyh" Date: Sun, 8 Nov 2009 08:29:35 +0000 Subject: [PATCH] readme.txt fix --- Rules.make | 2 +- Rules.make.standalone | 4 +- config.make | 1 + configure.sh | 104 +++++++++++++++++++++++++++++++++++++++ readme.txt | 4 ++ src/instead/Makefile | 2 + src/sdl-instead/Makefile | 1 + 7 files changed, 115 insertions(+), 3 deletions(-) create mode 100644 config.make create mode 100755 configure.sh diff --git a/Rules.make b/Rules.make index d0f4e26..ea604df 120000 --- a/Rules.make +++ b/Rules.make @@ -1 +1 @@ -Rules.make.standalone \ No newline at end of file +Rules.make.system \ No newline at end of file diff --git a/Rules.make.standalone b/Rules.make.standalone index 97fe98d..2ac691f 100644 --- a/Rules.make.standalone +++ b/Rules.make.standalone @@ -16,8 +16,8 @@ LUA_LFLAGS=$(shell pkg-config --libs lua5.1) # for arch linux, fedora (may be others) use this # -LUA_CFLAGS=$(shell pkg-config --cflags lua) -LUA_LFLAGS=$(shell pkg-config --libs lua) +# LUA_CFLAGS=$(shell pkg-config --cflags lua) +# LUA_LFLAGS=$(shell pkg-config --libs lua) # SDL_CFLAGS=$(shell sdl-config --cflags) diff --git a/config.make b/config.make new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/config.make @@ -0,0 +1 @@ + diff --git a/configure.sh b/configure.sh new file mode 100755 index 0000000..db729d7 --- /dev/null +++ b/configure.sh @@ -0,0 +1,104 @@ +echo -n "Checking pkg-config..." +if ! pkg-config --version >/dev/null 2>&1; then + echo "no pkg-config in PATH." + exit 1 +fi +echo "ok" +echo -n "Checking pkg-config --cflags lua..." +if ! pkg-config --cflags lua >/dev/null 2>&1; then + if ! pkg-config --cflags lua5.1 >/dev/null 2>&1; then + echo "failed" + exit 1 + fi + echo "lua5.1" + lua_cflags="pkg-config --cflags lua5.1" + lua_libs="pkg-config --libs lua5.1" +else + echo "lua" + lua_cflags="pkg-config --cflags lua" + lua_libs="pkg-config --libs lua" +fi + +echo -n "Checking sdl-config..." +if ! sdl-config --version >/dev/null 2>&1; then + echo "no sdl-config in PATH." + exit 1 +fi +echo "ok" +echo -n "Checking sdl-config --cflags..." +if ! sdl-config --cflags >/dev/null 2>&1; then + echo "failed." + exit 1 +fi +echo "ok" + +ops=`$lua_cflags` +ops=$ops" "`$lua_libs` + +echo -n "Looking for compiler..." +if ! cc --version >/dev/null 2>&1; then + if ! gcc --version >/dev/null 2>&1; then + if ! $(CC) --version >/dev/null 2>&1; then + echo "cc, gcc, \$(CC) are not valid compilers... Please, export CC for valid one..."; + exit 1; + else + cc=$CC; + fi + else + cc="gcc" + fi +else + cc="cc" +fi + +cat << EOF >/tmp/sdl-test.c +#include +#include +#include +#include +#include +int main(int argc, char **argv) +{ + return 1; +} +EOF +echo $cc +echo -n "Checking test build...(" +echo $cc /tmp/sdl-test.c $ops `sdl-config --cflags` `sdl-config --libs` -lSDL_ttf -lSDL_mixer -lSDL_image +if ! $cc /tmp/sdl-test.c $ops `sdl-config --cflags` `sdl-config --libs` -lSDL_ttf -lSDL_mixer -lSDL_image; then + echo ") failed". + echo "Please, check those dev packages installed: SDL_ttf SDL_mixer SDL_image." + rm /tmp/sdl-test.c + exit 1 +fi +echo ") ok" +rm /tmp/sdl-test.c +echo -n "Generating config.make..." +echo "LUA_CFLAGS=\$(shell $lua_cflags)" > config.make +echo "LUA_LFLAGS=\$(shell $lua_libs)" >> config.make +echo "SDL_CFLAGS=\$(shell sdl-config --cflags)" >> config.make +echo "SDL_LFLAGS=\$(shell sdl-config --libs) -lSDL_ttf -lSDL_mixer -lSDL_image" >> config.make +echo "ok" +echo -n "Do you want game will run standalone(1) or will be installed in system(2): " +read ans +if [ "$ans" == "1" ]; then + rm -f Rules.make + ln -s Rules.make.standalone Rules.make + if ! make clean >/dev/null 2>&1; then + echo "* Warning! Can not do make clean..." + fi + echo "Ok, now do:" + echo " make; ./sdl-instead" +elif [ "$ans" == "2" ]; then + rm -f Rules.make + ln -s Rules.make.system Rules.make + if ! make clean >/dev/null 2>&1; then + echo "* Warning! Can not do make clean..." + fi + echo "Ok, now do:" + echo " make; make install; sdl-instead" +else + echo "Wrong answer." + exit 1 +fi +echo "Bye..." diff --git a/readme.txt b/readme.txt index c5667aa..82fd383 100644 --- a/readme.txt +++ b/readme.txt @@ -24,3 +24,7 @@ On debian systems: building deb package: apt-get install build-essential debuild + +*** + +Or you can try ./configure.sh. \ No newline at end of file diff --git a/src/instead/Makefile b/src/instead/Makefile index 7ef2cea..7e0790d 100644 --- a/src/instead/Makefile +++ b/src/instead/Makefile @@ -1,5 +1,7 @@ #!/usr/bin/make -f include ../../Rules.make +include ../../config.make + all: instead instead: instead.c rline.c $(CC) $(CFLAGS) -DSTEAD_PATH=\"${STEADPATH}/\" instead.c $(LUA_CFLAGS) rline.c $(LUA_LFLAGS) -lncurses -lreadline -o instead diff --git a/src/sdl-instead/Makefile b/src/sdl-instead/Makefile index f65e9c3..af3b085 100644 --- a/src/sdl-instead/Makefile +++ b/src/sdl-instead/Makefile @@ -1,4 +1,5 @@ include ../../Rules.make +include ../../config.make CFLAGS += $(SDL_CFLAGS) $(LUA_CFLAGS) -DLANG_PATH=\"${LANGPATH}/\" -DSTEAD_PATH=\"${STEADPATH}/\" -DGAMES_PATH=\"${GAMESPATH}/\" -DTHEMES_PATH=\"${THEMESPATH}/\" -DVERSION=$(VERSION) -DICON_PATH=\"${ICONPATH}/\"