From: Charles McGarvey Date: Thu, 4 Mar 2010 08:20:56 +0000 (-0700) Subject: new win32 deps script; using pkgconfig for openal X-Git-Url: https://git.dogcows.com/gitweb?a=commitdiff_plain;h=321f005b45580b8c2c14ddc577fb6ca7780a68c5;p=chaz%2Fyoink new win32 deps script; using pkgconfig for openal --- diff --git a/configure.ac b/configure.ac index 7a01c45..a35b3a4 100644 --- a/configure.ac +++ b/configure.ac @@ -70,12 +70,12 @@ AC_ARG_ENABLE([debug], [debug=no]) AC_ARG_ENABLE([double-precision], - [ --enable-double-precision use double-precision numbers], + [ --enable-double-precision use doubles instead of floats], [double_precision=$enableval], [double_precision=no]) AC_ARG_ENABLE([profile], - [ --enable-profile make a binary for use with gprof profiler], + [ --enable-profile make a binary with code profiling instructions], [profile=$enableval], [profile=no]) @@ -84,18 +84,23 @@ AC_ARG_ENABLE([extra-warnings], [extra_warnings=$enableval], [extra_warnings=no]) +AC_ARG_ENABLE([clock_gettime], + [ --enable-clock_gettime use clock_gettime() instead of SDL_GetTicks()], + [clock_gettime=$enableval], + [clock_gettime=no]) + AC_ARG_ENABLE([threads], - [ --enable-threads use threads for some parallel tasks], + [ --enable-threads use threads for concurrency where appropriate], [threads=$enableval], [threads=no]) AC_ARG_ENABLE([gtk], - [ --enable-gtk enable GTK+ info/warning dialogs], + [ --enable-gtk enable GTK+ modal dialogs], [gtk=$enableval], [gtk=no]) AC_ARG_ENABLE([qt4], - [ --enable-qt4 enable QT info/warning dialogs], + [ --enable-qt4 enable QT modal dialogs], [qt4=$enableval], [qt4=no]) @@ -138,11 +143,11 @@ fi if test x$gtk = xyes then AC_DEFINE([USE_GTK], 1, - [Define to 1 if you want to use GTK+ info/error dialogs.]) + [Define to 1 if you want to use GTK+ modal dialogs.]) elif test x$qt4 = xyes then AC_DEFINE([USE_QT4], 1, - [Define to 1 if you want to use QT4 info/error dialogs.]) + [Define to 1 if you want to use QT4 modal dialogs.]) fi @@ -211,15 +216,20 @@ AC_HEADER_STDC AC_CHECK_HEADERS([stddef.h stdint.h stdlib.h string.h unistd.h]) ##### clock_gettime ##### -AC_SEARCH_LIBS([clock_gettime], [rt], - [AC_DEFINE([HAVE_CLOCK_GETTIME], 1, - [Define to 1 if you have the 'clock_gettime' function.])]) +if test x$clock_gettime = xyes +then + AC_SEARCH_LIBS([clock_gettime], [rt], + [AC_DEFINE([HAVE_CLOCK_GETTIME], 1, + [Define to 1 if you have the 'clock_gettime' function.])]) +fi # # Checks for build dependencies. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +echo "checking for dependencies..." + ##### boost ##### website="http://www.boost.org/" BOOST_SMART_PTR @@ -229,38 +239,21 @@ BOOST_FUNCTION ##### SDL ##### website="http://www.libsdl.org/" -AM_PATH_SDL([1.2.10], - [CFLAGS="$CFLAGS $SDL_CFLAGS" - CXXFLAGS="$CXXFLAGS $SDL_CFLAGS" - LIBS="$LIBS $SDL_LIBS"]) +PKG_CHECK_MODULES([SDL], [sdl], + [LIBS="$LIBS $SDL_LIBS" + CFLAGS="$CFLAGS $SDL_CFLAGS" + CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"], + [missing=yes + echo "***** Missing SDL ($website) *****"]) ##### opengl, glu ##### website="http://www.mesa3d.org/" -AC_CHECK_HEADERS([GL/gl.h GL/glu.h],, - [missing=yes - echo "***** Missing GL headers ($website) *****"]) -if test x$WIN32 = xyes -then -# autoconf library search macro doesn't find opengl32 on windows because it uses -# different name hashing or something, but it links fine; assume it's there - LIBS="$LIBS -lglu32 -lopengl32" -else - AC_SEARCH_LIBS([glEnable], [GL MesaGL],, - [missing=yes - echo "***** Missing libGL ($website) *****"]) - AC_SEARCH_LIBS([gluDisk], [GLU MesaGLU],, - [missing=yes - echo "***** Missing libGLU ($website) *****"]) -fi - -##### openal ##### -website="http://connect.creativelabs.com/openal/" -AC_CHECK_HEADERS([AL/al.h AL/alc.h],, - [missing=yes - echo "***** Missing OpenAL headers ($website) *****"]) -AC_SEARCH_LIBS([alEnable], [openal OpenAL32],, - [missing=yes - echo "***** Missing libopenal ($website) *****"]) +PKG_CHECK_MODULES([OPENGL], [gl glu], + [LIBS="$LIBS $OPENGL_LIBS" + CFLAGS="$CFLAGS $OPENGL_CFLAGS" + CXXFLAGS="$CXXFLAGS $GLU_CFLAGS"], + [missing=yes + echo "***** Missing OpenGL ($website) *****"]) ##### liblua ##### website="http://www.lua.org/" @@ -280,6 +273,15 @@ PKG_CHECK_MODULES([PNG], [libpng], [missing=yes echo "***** Missing libpng ($website) *****"]) +##### openal ##### +website="http://connect.creativelabs.com/openal/" +PKG_CHECK_MODULES([OPENAL], [openal], + [LIBS="$LIBS $OPENAL_LIBS" + CFLAGS="$CFLAGS $OPENAL_CFLAGS" + CXXFLAGS="$CXXFLAGS $OPENAL_CFLAGS"], + [missing=yes + echo "***** Missing OpenAL ($website) *****"]) + ##### libvorbis ##### website="http://www.xiph.org/downloads/" PKG_CHECK_MODULES([VORBIS], [vorbisfile], @@ -316,7 +318,7 @@ fi if test x$missing == xyes then - AC_MSG_WARN([It looks like you're missing some dependencies--building may fail.]) + AC_MSG_WARN([It looks like you're missing some dependencies--building may fail!]) fi @@ -359,13 +361,13 @@ AC_OUTPUT echo "" echo " Configuration complete! :-)" echo "" -echo " Target: $target" -echo " Prefix: $prefix" -echo " Data Directory: $DATADIR" -echo " Debug: $debug" -echo " Double Precision: $double_precision" -echo " Profile: $profile" -echo " Extra Warnings: $extra_warnings" +echo " Host: $target" +echo " Prefix: $prefix" +echo " Data: $DATADIR" +echo "" +echo " CXX: $CXX" +echo " CXXFLAGS: $(echo $CXXFLAGS)" +echo " LIBS: $(echo $LIBS)" echo "" echo " To finish the installation, execute:" echo " make" diff --git a/doc/yoink.6.in b/doc/yoink.6.in index 57af5e9..4de4353 100644 --- a/doc/yoink.6.in +++ b/doc/yoink.6.in @@ -141,8 +141,8 @@ If set to a path of a valid directory (presumably your home directory), config file. .TP .I USER -\fByoink\fP uses this variable to guess the user's nickname, for a high -score entry or whatever. +\fByoink\fP uses this variable as the user's name, for a high score entry +or whatever. .TP .I YOINK_DATADIR If set to a path of a valid directory, \fByoink\fP will look in this diff --git a/src/Main.cc b/src/Main.cc index fc84ceb..835f3d0 100644 --- a/src/Main.cc +++ b/src/Main.cc @@ -40,8 +40,6 @@ Main::Main(Mf::Settings& settings, Mf::Video& video) : mNewContextDispatch = dispatch.addTarget("video.newcontext", boost::bind(&Main::setupGL)); setupGL(); - - addChild(TitleLayer::alloc()); } @@ -49,9 +47,10 @@ void Main::update(Mf::Scalar t, Mf::Scalar dt) { if (children().size() == 0) { - Mf::logWarning("main view has no children"); - stop(); - return; + //Mf::logWarning("main view has no children"); + //stop(); + //return; + addChild(TitleLayer::alloc()); } Mf::View::update(t, dt); @@ -227,6 +226,10 @@ void Main::printInfo(int argc, char* argv[]) << " Compiler: "COMPILER_STRING << std::endl << " Assets: " << assets << std::endl << "Build options: " +#ifndef HAVE_CLOCK_GETTIME + << "-" +#endif + << "clock_gettime " #ifdef NDEBUG << "-" #endif diff --git a/src/Moof/Image.cc b/src/Moof/Image.cc index 2237c88..1581352 100644 --- a/src/Moof/Image.cc +++ b/src/Moof/Image.cc @@ -74,7 +74,6 @@ public: { std::string path(name); - logInfo << "opening image file " << path << std::endl; FILE* fp = Image::openFile(path); if (!fp) return; @@ -97,14 +96,10 @@ public: png_textp texts = 0; int numTexts; - logInfo("checking signature..."); bytesRead = fread(signature, 1, sizeof(signature), fp); - logInfo << "reading " << bytesRead << " bytes of signature" - << std::endl; if (bytesRead < sizeof(signature) || png_sig_cmp(signature, 0, sizeof(signature)) != 0) goto cleanup; - logInfo("creating png structures..."); pngObj = png_create_read_struct(PNG_LIBPNG_VER_STRING, 0, 0, 0); if (!pngObj) goto cleanup; @@ -114,7 +109,6 @@ public: pngInfoEnd = png_create_info_struct(pngObj); if (!pngInfoEnd) goto cleanup; - logInfo("setting up long jump..."); if (setjmp(png_jmpbuf(pngObj))) goto cleanup; png_init_io(pngObj, fp); @@ -122,7 +116,6 @@ public: png_read_info(pngObj, pngInfo); bpp = png_get_bit_depth(pngObj, pngInfo); - logInfo << "texture bpp: " << bpp << std::endl; colors = png_get_color_type(pngObj, pngInfo); switch (colors) { @@ -147,13 +140,11 @@ public: channels = png_get_channels(pngObj, pngInfo); mDepth = bpp * channels; - logInfo << "texture channels: " << channels << std::endl; if (channels == 3) mColorMode = GL_RGB; else mColorMode = GL_RGBA; // read comments png_get_text(pngObj, pngInfo, &texts, &numTexts); - logInfo << "num texts: " << numTexts << std::endl; for (int i = 0; i < numTexts; ++i) { if (strncmp(texts[i].key, "TextureInfo", 11) == 0) @@ -211,7 +202,6 @@ public: cleanup: - logInfo("cleaning up..."); delete[] rows; png_destroy_read_struct(pngObj ? &pngObj : 0, pngInfo ? &pngInfo : 0, diff --git a/src/Moof/Video.cc b/src/Moof/Video.cc index 195f413..9ca53c1 100644 --- a/src/Moof/Video.cc +++ b/src/Moof/Video.cc @@ -9,6 +9,7 @@ * **************************************************************************/ +#include "Dispatch.hh" #include "Error.hh" #include "Image.hh" #include "Log.hh" @@ -19,15 +20,13 @@ namespace Mf { -Video::Video() : - mDispatch(Dispatch::global()) +Video::Video() { init(); } Video::Video(const Attributes& attribs) : - mAttribs(attribs), - mDispatch(Dispatch::global()) + mAttribs(attribs) { init(); } @@ -123,14 +122,14 @@ void Video::setVideoMode(const int mode[3]) #if !defined(linux) && !defined(__linux) && !defined(__linux__) logInfo("video context recreated"); - mDispatch.dispatch("video.newcontext"); + Dispatch::global().dispatch("video.newcontext"); #endif } else Error(Error::SDL_VIDEOMODE).raise(); } } -Video::Attributes Video::getAttributes() const +Video::Attributes Video::attributes() const { return mAttribs; } @@ -289,12 +288,6 @@ void Video::makeCurrent() const } -void Video::setDispatch(Dispatch& dispatch) -{ - mDispatch = dispatch; -} - - Video::Attributes::Attributes() { init(); diff --git a/src/Moof/Video.hh b/src/Moof/Video.hh index d20ce4e..8d8e6f3 100644 --- a/src/Moof/Video.hh +++ b/src/Moof/Video.hh @@ -18,11 +18,11 @@ #include #include -#include namespace Mf { + class Settings; class Video; @@ -78,7 +78,7 @@ public: ~Video(); void setVideoMode(const int mode[3]); - Attributes getAttributes() const; + Attributes attributes() const; void resize(int width, int height); bool iconify(); @@ -109,15 +109,13 @@ public: int getWidth() const; int getHeight() const; + void makeCurrent() const; + static Video* current() { return gCurrentVideo; } - void makeCurrent() const; - - void setDispatch(Dispatch& dispatch); - private: void init(); @@ -132,7 +130,6 @@ private: SDL_Surface* mContext; unsigned mFlags; Attributes mAttribs; - Dispatch& mDispatch; static Video* gCurrentVideo; }; diff --git a/win32/tools/makedeps.sh b/win32/tools/makedeps.sh new file mode 100755 index 0000000..378272c --- /dev/null +++ b/win32/tools/makedeps.sh @@ -0,0 +1,254 @@ +#!/bin/bash + +# Download and cross-compile dependencies for Yoink. This script requires +# bash, wget, unzip, tar, rsync, patch, make, install and sudo. Have fun! + +HOST="i686-mingw32" +PREFIX="/usr/$HOST/usr" + +MAKEOPTS="-j8" + +##### + +function die() +{ + echo "die:" $@ + exit 1 +} + +function sync() +{ + # install the files from $DESTDIR to $PREFIX + echo "Installing to $PREFIX..." + sudo rsync -av $DESTDIR/$PREFIX/* $PREFIX/ || die "syncing dependencies" +} + +DESTDIR="`pwd`/deps" +mkdir -p $DESTDIR +rm -f $DESTDIR/README + +PACKAGE="zlib123-dll" +cd $DESTDIR +[[ ! -f $PACKAGE.zip ]] && (wget "http://www.zlib.net/$PACKAGE.zip" || die "downloading $PACKAGE") +rm -rf $PACKAGE +unzip -d $PACKAGE $PACKAGE.zip || die "unpackaging $PACKAGE" +cd $PACKAGE +($HOST-dlltool -d lib/zlib.def -l libzdll.a && \ +mkdir -p $DESTDIR/$PREFIX/{lib,include} && \ +install -p -m 0644 include/* $DESTDIR/$PREFIX/include/ && \ +install -p -m 0755 zlib1.dll $DESTDIR/$PREFIX/bin/ && \ +install -p -m 0755 libzdll.a $DESTDIR/$PREFIX/lib/ && \ +cd $DESTDIR/$PREFIX/lib && \ +ln -fs libzdll.a libz.dll.a) || die "installing $PACKAGE" + +PACKAGE="libogg-1.1.4" +cd $DESTDIR +[[ ! -f $PACKAGE.tar.gz ]] && (wget "http://downloads.xiph.org/releases/ogg/$PACKAGE.tar.gz" || die "downloading $PACKAGE") +rm -rf $PACKAGE +tar xzf $PACKAGE.tar.gz || die "unpackaging $PACKAGE" +cd $PACKAGE +./configure --host=$HOST --prefix=$PREFIX || die "configuring $PACKAGE" +make $MAKEOPTS || die "making $PACKAGE" +make DESTDIR=$DESTDIR install || die "installing $PACKAGE" + +# install dependencies thus built thus far +sync + +PACKAGE="boost_1_42_0" +VERSION="1.42.0" +cd $DESTDIR +[[ ! -f $PACKAGE.tar.bz2 ]] && (wget "http://sourceforge.net/projects/boost/files/boost/$VERSION/$PACKAGE.tar.bz2/download" || die "downloading $PACKAGE") +rm -rf $PACKAGE +tar xjf $PACKAGE.tar.bz2 || die "unpackaging $PACKAGE" +(mkdir -p $DESTDIR/$PREFIX/include && \ +rm -rf $DESTDIR/$PREFIX/include/boost && \ +cp -r $PACKAGE/boost $DESTDIR/$PREFIX/include/boost) || die "installing $PACKAGE" + +PACKAGE="SDL-1.2.14" +cd $DESTDIR +[[ ! -f $PACKAGE.tar.gz ]] && (wget "http://www.libsdl.org/release/$PACKAGE.tar.gz" || die "downloading $PACKAGE") +rm -rf $PACKAGE +tar xzf $PACKAGE.tar.gz || die "unpackaging $PACKAGE" +cd $PACKAGE +./configure --host=$HOST --prefix=$PREFIX --disable-stdio-redirect || die "configuring $PACKAGE" +make $MAKEOPTS || die "making $PACKAGE" +make DESTDIR=$DESTDIR install || die "installing $PACKAGE" + +PACKAGE="libvorbis-1.2.3" +cd $DESTDIR +[[ ! -f $PACKAGE.tar.gz ]] && (wget "http://downloads.xiph.org/releases/vorbis/$PACKAGE.tar.gz" || die "downloading $PACKAGE") +rm -rf $PACKAGE +tar xzf $PACKAGE.tar.gz || die "unpackaging $PACKAGE" +cd $PACKAGE +./configure --host=$HOST --prefix=$PREFIX || die "configuring $PACKAGE" +make $MAKEOPTS || die "making $PACKAGE" +make DESTDIR=$DESTDIR install || die "installing $PACKAGE" + +PACKAGE="openal-soft-1.11.753-bin" +cd $DESTDIR +[[ ! -f $PACKAGE.zip ]] && (wget "http://kcat.strangesoft.net/$PACKAGE.zip" || die "downloading $PACKAGE") +rm -rf $PACKAGE +unzip $PACKAGE.zip || die "unpackaging $PACKAGE" +cd $PACKAGE +(mkdir -p $DESTDIR/$PREFIX/{lib/pkgconfig,include/AL} && \ +install -p -m 0644 include/AL/* $DESTDIR/$PREFIX/include/AL/ && \ +install -p -m 0755 Win32/soft_oal.dll $DESTDIR/$PREFIX/bin/OpenAL32.dll && \ +install -p -m 0755 openal-info.exe $DESTDIR/$PREFIX/bin/ && \ +install -p -m 0755 lib/Win32/libOpenAL32.dll.a $DESTDIR/$PREFIX/lib/ && \ +cat >$DESTDIR/$PREFIX/lib/pkgconfig/openal.pc <$DESTDIR/$PREFIX/lib/pkgconfig/gl.pc <$DESTDIR/$PREFIX/lib/pkgconfig/glu.pc <README <