From: Tim Goya Date: Mon, 1 Oct 2007 17:42:19 +0000 (+0000) Subject: Finish up CMake support, created a couple scripts to handle messages.pot generation... X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=9aa7909e583ee203065b37d75169cb1dcbfcdf12;p=supertux.git Finish up CMake support, created a couple scripts to handle messages.pot generation and distribution tarball creation. SVN-Revision: 5160 --- diff --git a/CMakeLists.txt b/CMakeLists.txt index d519ffc45..baa371673 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -35,7 +35,6 @@ # # FIXME: create config.h from config.h.in # FIXME: create messages.pot for levels -# FIXME: provide working install target # @@ -51,7 +50,7 @@ PROJECT(SUPERTUX) set(DEBUG 0 CACHE BOOL "Build with debugging options") set(ENABLE_BINRELOC 0 CACHE BOOL "Enable autopackage's BINRELOC features") -set(APPDATADIR "" CACHE STRING "APPDATADIR for autopackage's BINRELOC features") +set(APPDATADIR "${CMAKE_INSTALL_PREFIX}/share" CACHE STRING "APPDATADIR for autopackage's BINRELOC features") set(ENABLE_SQDBG 0 CACHE BOOL "Build squirrel script interpreter with debugging options") set(ENABLE_OPENGL 1 CACHE BOOL "Enable OpenGL support") @@ -71,9 +70,11 @@ LINK_LIBRARIES(${SDLIMAGE_LIBRARY}) IF(ENABLE_OPENGL) FIND_PACKAGE(OpenGL) - INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR}) - LINK_LIBRARIES(${OPENGL_LIBRARY}) - SET(HAVE_OPENGL OPENGL_FOUND) + IF(${OPENGL_FOUND} STREQUAL "YES") + INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR}) + LINK_LIBRARIES(${OPENGL_LIBRARY}) + SET(HAVE_OPENGL TRUE) + ENDIF(${OPENGL_FOUND} STREQUAL "YES") ENDIF(ENABLE_OPENGL) FIND_PACKAGE(OpenAL REQUIRED) @@ -125,32 +126,34 @@ FILE(GLOB SUPERTUX_SOURCES RELATIVE ${SUPERTUX_SOURCE_DIR} src/*.cpp src/audio/* ADD_CUSTOM_COMMAND( OUTPUT ${SUPERTUX_SOURCE_DIR}/src/scripting/wrapper.cpp ${SUPERTUX_SOURCE_DIR}/src/scripting/wrapper.hpp - COMMAND ${CMAKE_CXX_COMPILER} - ARGS -x "c++" -E -CC -DSCRIPTING_API -I${SUPERTUX_SOURCE_DIR}/src/ -I${SUPERTUX_SOURCE_DIR}/src/squirrel/include/ ${SUPERTUX_SOURCE_DIR}/src/scripting/wrapper.interface.hpp -o miniswig.tmp + COMMAND cd ${SUPERTUX_SOURCE_DIR} && ${CMAKE_CXX_COMPILER} + ARGS -x "c++" -E -CC -DSCRIPTING_API src/scripting/wrapper.interface.hpp -o ${SUPERTUX_BINARY_DIR}/miniswig.tmp COMMAND tools/miniswig/miniswig ARGS --input miniswig.tmp --output-cpp ${SUPERTUX_SOURCE_DIR}/src/scripting/wrapper.cpp --output-hpp ${SUPERTUX_SOURCE_DIR}/src/scripting/wrapper.hpp --module supertux --select-namespace Scripting DEPENDS src/scripting/wrapper.interface.hpp tools/miniswig/miniswig ) +SET(SUPERTUX_SOURCES ${SUPERTUX_SOURCE_DIR}/src/scripting/wrapper.cpp ${SUPERTUX_SOURCES}) + ## If xgettext is available, generate messages.pot for sources -FIND_PROGRAM( - XGETTEXT - NAMES "xgettext" - PATHS "/usr/bin" -) -IF(${XGETTEXT} STREQUAL "XGETTEXT-NOTFOUND") - MESSAGE(STATUS "Warning: xgettext not found - will not update messages.pot") -ELSE(${XGETTEXT} STREQUAL "XGETTEXT-NOTFOUND") - MESSAGE(STATUS "Found xgettext: ${XGETTEXT}") - SET(MESSAGES_POT_FILE ${SUPERTUX_SOURCE_DIR}/data/locale/messages.pot) - ADD_CUSTOM_TARGET( - supertux-messages.pot ALL - COMMAND "/usr/bin/xgettext" -k_ -C -o ${MESSAGES_POT_FILE} ${SUPERTUX_SOURCES} - DEPENDS ${SUPERTUX_SOURCES} - WORKING_DIRECTORY ${SUPERTUX_SOURCE_DIR} - ) -ENDIF(${XGETTEXT} STREQUAL "XGETTEXT-NOTFOUND") +#FIND_PROGRAM( +# XGETTEXT +# NAMES "xgettext" +# PATHS "/usr/bin" +#) +#IF(${XGETTEXT} STREQUAL "XGETTEXT-NOTFOUND") +# MESSAGE(STATUS "Warning: xgettext not found - will not update messages.pot") +#ELSE(${XGETTEXT} STREQUAL "XGETTEXT-NOTFOUND") +# MESSAGE(STATUS "Found xgettext: ${XGETTEXT}") +# SET(MESSAGES_POT_FILE ${SUPERTUX_SOURCE_DIR}/data/locale/messages.pot) +# ADD_CUSTOM_TARGET( +# supertux-messages.pot ALL +# COMMAND "/usr/bin/xgettext" -k_ -C -o ${MESSAGES_POT_FILE} ${SUPERTUX_SOURCES} +# DEPENDS ${SUPERTUX_SOURCES} +# WORKING_DIRECTORY ${SUPERTUX_SOURCE_DIR} +# ) +#ENDIF(${XGETTEXT} STREQUAL "XGETTEXT-NOTFOUND") ## Some additional compiler switches @@ -158,7 +161,7 @@ ADD_DEFINITIONS(-O2 -fno-strict-aliasing) ## Add target for supertux binary -ADD_EXECUTABLE(supertux2 ${SUPERTUX_SOURCES} ) +ADD_EXECUTABLE(supertux2 ${SUPERTUX_SOURCES}) ## Link supertux binary with squirrel @@ -173,3 +176,21 @@ ADD_CUSTOM_COMMAND( ARGS -E copy supertux2 ${SUPERTUX_SOURCE_DIR}/supertux2 ) +## Install stuff + +INSTALL(TARGETS supertux2 DESTINATION bin) + +INSTALL(FILES ${SUPERTUX_SOURCE_DIR}/data/images/engine/icons/supertux.png ${SUPERTUX_SOURCE_DIR}/data/images/engine/icons/supertux.xpm DESTINATION share/pixmaps) + +INSTALL(FILES ${SUPERTUX_SOURCE_DIR}/supertux2.desktop DESTINATION share/applications) + +INSTALL(FILES ${SUPERTUX_SOURCE_DIR}/INSTALL ${SUPERTUX_SOURCE_DIR}/README ${SUPERTUX_SOURCE_DIR}/COPYING ${SUPERTUX_SOURCE_DIR}/WHATSNEW.txt DESTINATION doc/supertux-0.3.x) + +INSTALL(FILES ${SUPERTUX_SOURCE_DIR}/data/credits.txt ${SUPERTUX_SOURCE_DIR}/data/camera.cfg DESTINATION share/supertux2) +INSTALL(DIRECTORY data/images DESTINATION share/supertux2 PATTERN ".svn" EXCLUDE) +INSTALL(DIRECTORY data/levels DESTINATION share/supertux2 PATTERN ".svn" EXCLUDE) +INSTALL(DIRECTORY data/music DESTINATION share/supertux2 PATTERN ".svn" EXCLUDE) +INSTALL(DIRECTORY data/scripts DESTINATION share/supertux2 PATTERN ".svn" EXCLUDE) +INSTALL(DIRECTORY data/speech DESTINATION share/supertux2 PATTERN ".svn" EXCLUDE) +INSTALL(DIRECTORY data/sounds DESTINATION share/supertux2 PATTERN ".svn" EXCLUDE) +INSTALL(DIRECTORY data/locale DESTINATION share/supertux2 PATTERN ".svn" EXCLUDE) diff --git a/config.h.cmake b/config.h.cmake index fda85c87e..28cd9e217 100644 --- a/config.h.cmake +++ b/config.h.cmake @@ -5,9 +5,7 @@ #cmakedefine ENABLE_SQDBG #cmakedefine ENABLE_BINRELOC -#ifdef ENABLE_BINRELOC -#define APPDATADIR ${APPDATADIR} -#endif +#define APPDATADIR "${APPDATADIR}" #define SIZEOF_VOID_P ${SIZEOF_VOID_P} #if SIZEOF_VOID_P == 8 diff --git a/makedist.sh b/makedist.sh new file mode 100755 index 000000000..72b7827d3 --- /dev/null +++ b/makedist.sh @@ -0,0 +1,17 @@ +#!/bin/sh +DISTDIR="supertux-0.3.x" +rm -rf $DISTDIR +mkdir $DISTDIR +cp "CMakeLists.txt" "COPYING" "INSTALL" "Jamconfig.in" "Jamfile" "Jamrules" "README" "WHATSNEW.txt" "autogen.sh" "config.h.in" "configure" "configure.ac" "config.h.cmake" "makedist.sh" "makepot.sh" "supertux2.desktop" $DISTDIR +cp --parents mk/autoconf/*.m4 mk/autoconf/config.guess mk/autoconf/config.sub mk/autoconf/install-sh $DISTDIR +cp --parents mk/jam/*.jam $DISTDIR +cp --parents mk/cmake/*.cmake $DISTDIR +cp --parents mk/msvc/* $DISTDIR +find contrib -type f -exec "cp" "--parents" "{}" "$DISTDIR" ";" -o -name .svn -prune +find data -type f -exec "cp" "--parents" "{}" "$DISTDIR" ";" -o -name .svn -prune +find docs -type f -exec "cp" "--parents" "{}" "$DISTDIR" ";" -o -name .svn -prune +find man -type f -exec "cp" "--parents" "{}" "$DISTDIR" ";" -o -name .svn -prune +find src -type f -exec "cp" "--parents" "{}" "$DISTDIR" ";" -o -name .svn -prune +find tools -type f -exec "cp" "--parents" "{}" "$DISTDIR" ";" -o -name .svn -prune +tar czf $DISTDIR.tar.gz $DISTDIR +tar cjf $DISTDIR.tar.bz2 $DISTDIR diff --git a/makepot.sh b/makepot.sh new file mode 100755 index 000000000..08b6e24cc --- /dev/null +++ b/makepot.sh @@ -0,0 +1,5 @@ +#!/bin/sh +xgettext --keyword='_' -C -o data/locale/messages.pot `find src -name "*.cpp"` +for LEVELSET in "bonus1" "bonus2" "contribs" "misc" "test" "world1" "world2"; do + xgettext --keyword='_:1' --language=Lisp --sort-by-file -C -o data/levels/$LEVELSET/messages.pot `find data/levels/$LEVELSET -name "*.stl"` `find data/levels/$LEVELSET -name "*.stwm"` `find data/levels/$LEVELSET -name "*.txt"` +done diff --git a/src/main.cpp b/src/main.cpp index aa998fd39..ade5d5d8d 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -193,12 +193,13 @@ static void init_physfs(const char* argv0) br_init (NULL); dir = br_find_data_dir(APPDATADIR); datadir = dir; - datadir += "/" PACKAGE_NAME; free(dir); #else datadir = APPDATADIR; #endif + datadir += "/"; + datadir += application; if(!PHYSFS_addToSearchPath(datadir.c_str(), 1)) { log_warning << "Couldn't add '" << datadir << "' to physfs searchpath: " << PHYSFS_getLastError() << std::endl; }