From 3e5611051bcbe259199895766c231259e0621dc4 Mon Sep 17 00:00:00 2001 From: psychomantys Date: Fri, 23 Aug 2013 21:53:41 -0300 Subject: [PATCH 01/21] First attempt to use autotools... --- Makefile.am | 68 ++++++++++ bootstrap.sh | 17 +++ build-aux/m4/dolt.m4 | 177 +++++++++++++++++++++++++ build-aux/packages/debian/control.in | 10 ++ cabrio.spec.in | 43 ++++++ configure.ac | 182 ++++++++++++++++++++++++++ packages/debian/control.in | 10 ++ src/Makefile.am | 22 ++++ bg.c => src/bg.c | 0 {include => src}/bg.h | 0 category.c => src/category.c | 0 {include => src}/category.h | 0 config.c => src/config.c | 0 {include => src}/config.h | 0 control.c => src/control.c | 0 {include => src}/control.h | 0 emulator.c => src/emulator.c | 0 {include => src}/emulator.h | 0 event.c => src/event.c | 0 {include => src}/event.h | 0 focus.c => src/focus.c | 0 {include => src}/focus.h | 0 font.c => src/font.c | 0 {include => src}/font.h | 0 frame.c => src/frame.c | 0 {include => src}/frame.h | 0 game.c => src/game.c | 0 {include => src}/game.h | 0 game_sel.c => src/game_sel.c | 0 {include => src}/game_sel.h | 0 hint.c => src/hint.c | 0 {include => src}/hint.h | 0 key.c => src/key.c | 0 {include => src}/key.h | 0 location.c => src/location.c | 0 {include => src}/location.h | 0 lookup.c => src/lookup.c | 0 {include => src}/lookup.h | 0 main.c => src/main.c | 0 media.c => src/media.c | 0 {include => src}/media.h | 0 menu.c => src/menu.c | 0 {include => src}/menu.h | 0 ogl.c => src/ogl.c | 0 {include => src}/ogl.h | 0 packet.c => src/packet.c | 0 {include => src}/packet.h | 0 platform.c => src/platform.c | 0 {include => src}/platform.h | 0 sdl_ogl.c => src/sdl_ogl.c | 0 {include => src}/sdl_ogl.h | 0 sdl_wrapper.c => src/sdl_wrapper.c | 0 {include => src}/sdl_wrapper.h | 0 setup.c => src/setup.c | 0 {include => src}/setup.h | 0 snap.c => src/snap.c | 0 {include => src}/snap.h | 0 sound.c => src/sound.c | 0 {include => src}/sound.h | 0 submenu.c => src/submenu.c | 0 {include => src}/submenu.h | 0 video.c => src/video.c | 0 {include => src}/video.h | 0 test/Makefile.am | 17 +++ test/build_script | 73 +++++++++++ test/deb.build | 3 + test/debug.build | 1 + test/default_flags_to_configure.build | 4 + test/rpm.build | 3 + test/simple.build | 1 + 70 files changed, 631 insertions(+) create mode 100644 Makefile.am create mode 100755 bootstrap.sh create mode 100644 build-aux/m4/dolt.m4 create mode 100644 build-aux/packages/debian/control.in create mode 100644 cabrio.spec.in create mode 100644 configure.ac create mode 100644 packages/debian/control.in create mode 100644 src/Makefile.am rename bg.c => src/bg.c (100%) rename {include => src}/bg.h (100%) rename category.c => src/category.c (100%) rename {include => src}/category.h (100%) rename config.c => src/config.c (100%) rename {include => src}/config.h (100%) rename control.c => src/control.c (100%) rename {include => src}/control.h (100%) rename emulator.c => src/emulator.c (100%) rename {include => src}/emulator.h (100%) rename event.c => src/event.c (100%) rename {include => src}/event.h (100%) rename focus.c => src/focus.c (100%) rename {include => src}/focus.h (100%) rename font.c => src/font.c (100%) rename {include => src}/font.h (100%) rename frame.c => src/frame.c (100%) rename {include => src}/frame.h (100%) rename game.c => src/game.c (100%) rename {include => src}/game.h (100%) rename game_sel.c => src/game_sel.c (100%) rename {include => src}/game_sel.h (100%) rename hint.c => src/hint.c (100%) rename {include => src}/hint.h (100%) rename key.c => src/key.c (100%) rename {include => src}/key.h (100%) rename location.c => src/location.c (100%) rename {include => src}/location.h (100%) rename lookup.c => src/lookup.c (100%) rename {include => src}/lookup.h (100%) rename main.c => src/main.c (100%) rename media.c => src/media.c (100%) rename {include => src}/media.h (100%) rename menu.c => src/menu.c (100%) rename {include => src}/menu.h (100%) rename ogl.c => src/ogl.c (100%) rename {include => src}/ogl.h (100%) rename packet.c => src/packet.c (100%) rename {include => src}/packet.h (100%) rename platform.c => src/platform.c (100%) rename {include => src}/platform.h (100%) rename sdl_ogl.c => src/sdl_ogl.c (100%) rename {include => src}/sdl_ogl.h (100%) rename sdl_wrapper.c => src/sdl_wrapper.c (100%) rename {include => src}/sdl_wrapper.h (100%) rename setup.c => src/setup.c (100%) rename {include => src}/setup.h (100%) rename snap.c => src/snap.c (100%) rename {include => src}/snap.h (100%) rename sound.c => src/sound.c (100%) rename {include => src}/sound.h (100%) rename submenu.c => src/submenu.c (100%) rename {include => src}/submenu.h (100%) rename video.c => src/video.c (100%) rename {include => src}/video.h (100%) create mode 100644 test/Makefile.am create mode 100644 test/build_script create mode 100644 test/deb.build create mode 100644 test/debug.build create mode 100644 test/default_flags_to_configure.build create mode 100644 test/rpm.build create mode 100644 test/simple.build diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..95e25e1 --- /dev/null +++ b/Makefile.am @@ -0,0 +1,68 @@ +SUBDIRS=src/ test + +## Place generated object files (.o) into the same directory as their source +## files, in order to avoid collisions when non-recursive make is used. +AUTOMAKE_OPTIONS = subdir-objects + +## Additional flags to pass to aclocal when it is invoked automatically at +## make time. The ${ACLOCAL_FLAGS} variable is picked up from the environment +## to provide a way for the user to supply additional arguments. +ACLOCAL_AMFLAGS = ${ACLOCAL_FLAGS} + +## Install the generated pkg-config file (.pc) into the expected location for +## architecture-dependent package configuration information. Occasionally, +## pkg-config files are also used for architecture-independent data packages, +## in which case the correct install location would be $(datadir)/pkgconfig. +##pkgconfigdir = $(libdir)/pkgconfig +##pkgconfig_DATA = cabrio-$(PACKAGE_VERSION_MAJOR).pc + +## Define an independent executable script for inclusion in the distribution +## archive. However, it will not be installed on an end user's system due to +## the noinst_ prefix. +dist_noinst_SCRIPTS = bootstrap.sh + + +TEMP_PKG_RPM_DIR=$(abs_top_builddir)/packages/rpm +TEMP_PKG_DEB_DIR=$(abs_top_builddir)/packages/debian/root + +# Create a deb package +pkg-deb: + mkdir -p $(TEMP_PKG_DEB_DIR)/DEBIAN + + make DESTDIR=$(TEMP_PKG_DEB_DIR) install + cp packages/debian/control $(TEMP_PKG_DEB_DIR)/DEBIAN/control + echo -n 'Depends: ' >> $(TEMP_PKG_DEB_DIR)/DEBIAN/control + find $(TEMP_PKG_DEB_DIR) -not -type d | xargs -n1 objdump -p 2>/dev/null \ + | grep 'NEEDED ' |tr -s ' ' |cut -f 3 -d ' ' | \ + xargs -n1 dpkg -S |cut -f1 -d: |sort -u | xargs echo | tr ' ' ',' >> $(TEMP_PKG_DEB_DIR)/DEBIAN/control + dpkg --build $(TEMP_PKG_DEB_DIR) $(TEMP_PKG_DEB_DIR)/../$(PACKAGE_NAME)-$(PACKAGE_VERSION_API).deb + - rm -r $(TEMP_PKG_DEB_DIR) + +# Create an RPM package +# Depend of all rule +pkg-rpm: all + mkdir -p $(TEMP_PKG_RPM_DIR)/RPMS/i386 + mkdir -p $(TEMP_PKG_RPM_DIR)/SRPMS + mkdir -p $(TEMP_PKG_RPM_DIR)/BUILD + mkdir -p $(TEMP_PKG_RPM_DIR)/SOURCES + mkdir -p $(TEMP_PKG_RPM_DIR)/tmp + @- rm -r $(TEMP_PKG_RPM_DIR)/BUILD/$(PACKAGE_NAME)-root + @- ln -s $(abs_top_builddir) $(TEMP_PKG_RPM_DIR)/BUILD/$(PACKAGE_NAME)-root + @- rm -r $(TEMP_PKG_RPM_DIR)/RPMS/$(PACKAGE_NAME)-* + @- rm -r $(TEMP_PKG_RPM_DIR)/SRPMS/$(PACKAGE_NAME)-* + @- rm -r $(TEMP_PKG_RPM_DIR)/SOURCES/$(PACKAGE_NAME)-* + +# Find binary deps for binary in $(abs_top_builddir) to write in rpm +# deps in cabrio.spec + sed -i s/"^Requires: .*/Requires: ` ( find $(abs_top_builddir) -not -type d \ + | xargs -n1 objdump -p | grep 'NEEDED ' \ + | tr -s ' ' |cut -f 3 -d ' ' | sort -u \ + | xargs -n 1 printf -- " -e %s" \ + | xargs -I'{}' bash -c 'rpm -q -a --filesbypkg | grep {}' \ + | tr -s ' ' | cut -f1 -d ' ' | sort -u \ + | xargs echo | tr ' ' ',' ) 2> /dev/null `/"g $(abs_top_builddir)/$(PACKAGE_NAME).spec + + - rpmbuild --with noconfigure --quiet --nodeps --define="_topdir $(TEMP_PKG_RPM_DIR)" \ + -bb $(abs_top_builddir)/$(PACKAGE_NAME).spec + mv $(TEMP_PKG_RPM_DIR)/RPMS/i386/$(PACKAGE_NAME)-$(PACKAGE_VERSION_API)-*.i386.rpm $(TEMP_PKG_RPM_DIR)/../ + diff --git a/bootstrap.sh b/bootstrap.sh new file mode 100755 index 0000000..5cbc277 --- /dev/null +++ b/bootstrap.sh @@ -0,0 +1,17 @@ +#!/bin/sh -e + +test -n "${srcdir}" || srcdir=`dirname "$0"` +test -n "${srcdir}" || srcdir=. + +if [ ! "${NO_CHANGELOG}" ] ; then +( + cd "${srcdir}" + svn log > ChangeLog +) +fi + +libtoolize --ltdl +autoreconf --force --install --verbose "$srcdir" +test -n "${NOCONFIGURE}" || "${srcdir}/configure" "$@" +#test -n "${NOCONFIGURE}" || "${srcdir}/configure" --enable-silent-rules --disable-dependency-tracking "$@" + diff --git a/build-aux/m4/dolt.m4 b/build-aux/m4/dolt.m4 new file mode 100644 index 0000000..177abb3 --- /dev/null +++ b/build-aux/m4/dolt.m4 @@ -0,0 +1,177 @@ +dnl dolt, a replacement for libtool +dnl Copyright © 2007-2010 Josh Triplett +dnl Copying and distribution of this file, with or without modification, +dnl are permitted in any medium without royalty provided the copyright +dnl notice and this notice are preserved. +dnl +dnl To use dolt, invoke the DOLT macro immediately after the libtool macros. +dnl Optionally, copy this file into acinclude.m4, to avoid the need to have it +dnl installed when running autoconf on your project. + +AC_DEFUN([DOLT], [ +AC_REQUIRE([AC_CANONICAL_HOST]) +# dolt, a replacement for libtool +# Josh Triplett +AC_PATH_PROG(DOLT_BASH, bash) +AC_MSG_CHECKING([if dolt supports this host]) +dolt_supported=yes +if test x$DOLT_BASH = x; then + dolt_supported=no +fi +if test x$GCC != xyes; then + dolt_supported=no +fi +case $host in +i?86-*-linux*|x86_64-*-linux*|powerpc-*-linux*|sparc*-*-linux* \ +|amd64-*-freebsd*|i?86-*-freebsd*|ia64-*-freebsd*) + pic_options='-fPIC' + ;; +i?86-apple-darwin*) + pic_options='-fno-common' + ;; +*) + dolt_supported=no + ;; +esac +if test x$dolt_supported = xno ; then + AC_MSG_RESULT([no, falling back to libtool]) + LTCOMPILE='$(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(COMPILE)' + LTCXXCOMPILE='$(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXXCOMPILE)' +else + AC_MSG_RESULT([yes, replacing libtool]) + +dnl Start writing out doltcompile. + cat <<__DOLTCOMPILE__EOF__ >doltcompile +#!$DOLT_BASH +__DOLTCOMPILE__EOF__ + cat <<'__DOLTCOMPILE__EOF__' >>doltcompile +args=("$[]@") +for ((arg=0; arg<${#args@<:@@@:>@}; arg++)) ; do + if test x"${args@<:@$arg@:>@}" = x-o ; then + objarg=$((arg+1)) + break + fi +done +if test x$objarg = x ; then + echo 'Error: no -o on compiler command line' 1>&2 + exit 1 +fi +lo="${args@<:@$objarg@:>@}" +obj="${lo%.lo}" +if test x"$lo" = x"$obj" ; then + echo "Error: libtool object file name \"$lo\" does not end in .lo" 1>&2 + exit 1 +fi +objbase="${obj##*/}" +__DOLTCOMPILE__EOF__ + +dnl Write out shared compilation code. + if test x$enable_shared = xyes; then + cat <<'__DOLTCOMPILE__EOF__' >>doltcompile +libobjdir="${obj%$objbase}.libs" +if test ! -d "$libobjdir" ; then + mkdir_out="$(mkdir "$libobjdir" 2>&1)" + mkdir_ret=$? + if test "$mkdir_ret" -ne 0 && test ! -d "$libobjdir" ; then + echo "$mkdir_out" 1>&2 + exit $mkdir_ret + fi +fi +pic_object="$libobjdir/$objbase.o" +args@<:@$objarg@:>@="$pic_object" +__DOLTCOMPILE__EOF__ + cat <<__DOLTCOMPILE__EOF__ >>doltcompile +"\${args@<:@@@:>@}" $pic_options -DPIC || exit \$? +__DOLTCOMPILE__EOF__ + fi + +dnl Write out static compilation code. +dnl Avoid duplicate compiler output if also building shared objects. + if test x$enable_static = xyes; then + cat <<'__DOLTCOMPILE__EOF__' >>doltcompile +non_pic_object="$obj.o" +args@<:@$objarg@:>@="$non_pic_object" +__DOLTCOMPILE__EOF__ + if test x$enable_shared = xyes; then + cat <<'__DOLTCOMPILE__EOF__' >>doltcompile +"${args@<:@@@:>@}" >/dev/null 2>&1 || exit $? +__DOLTCOMPILE__EOF__ + else + cat <<'__DOLTCOMPILE__EOF__' >>doltcompile +"${args@<:@@@:>@}" || exit $? +__DOLTCOMPILE__EOF__ + fi + fi + +dnl Write out the code to write the .lo file. +dnl The second line of the .lo file must match "^# Generated by .*libtool" + cat <<'__DOLTCOMPILE__EOF__' >>doltcompile +{ +echo "# $lo - a libtool object file" +echo "# Generated by doltcompile, not libtool" +__DOLTCOMPILE__EOF__ + + if test x$enable_shared = xyes; then + cat <<'__DOLTCOMPILE__EOF__' >>doltcompile +echo "pic_object='.libs/${objbase}.o'" +__DOLTCOMPILE__EOF__ + else + cat <<'__DOLTCOMPILE__EOF__' >>doltcompile +echo pic_object=none +__DOLTCOMPILE__EOF__ + fi + + if test x$enable_static = xyes; then + cat <<'__DOLTCOMPILE__EOF__' >>doltcompile +echo "non_pic_object='${objbase}.o'" +__DOLTCOMPILE__EOF__ + else + cat <<'__DOLTCOMPILE__EOF__' >>doltcompile +echo non_pic_object=none +__DOLTCOMPILE__EOF__ + fi + + cat <<'__DOLTCOMPILE__EOF__' >>doltcompile +} > "$lo" +__DOLTCOMPILE__EOF__ + +dnl Done writing out doltcompile; substitute it for libtool compilation. + chmod +x doltcompile + LTCOMPILE='$(top_builddir)/doltcompile $(COMPILE)' + LTCXXCOMPILE='$(top_builddir)/doltcompile $(CXXCOMPILE)' + +dnl automake ignores LTCOMPILE and LTCXXCOMPILE when it has separate CFLAGS for +dnl a target, so write out a libtool wrapper to handle that case. +dnl Note that doltlibtool does not handle inferred tags or option arguments +dnl without '=', because automake does not use them. + cat <<__DOLTLIBTOOL__EOF__ > doltlibtool +#!$DOLT_BASH +__DOLTLIBTOOL__EOF__ + cat <<'__DOLTLIBTOOL__EOF__' >>doltlibtool +top_builddir_slash="${0%%doltlibtool}" +: ${top_builddir_slash:=./} +args=() +modeok=false +tagok=false +for arg in "$[]@"; do + case "$arg" in + --mode=compile) modeok=true ;; + --tag=CC|--tag=CXX) tagok=true ;; + *) args@<:@${#args[@]}@:>@="$arg" ;; + esac +done +if $modeok && $tagok ; then + . ${top_builddir_slash}doltcompile "${args@<:@@@:>@}" +else + exec ${top_builddir_slash}libtool "$[]@" +fi +__DOLTLIBTOOL__EOF__ + +dnl Done writing out doltlibtool; substitute it for libtool. + chmod +x doltlibtool + LIBTOOL='$(top_builddir)/doltlibtool' +fi +AC_SUBST(LTCOMPILE) +AC_SUBST(LTCXXCOMPILE) +# end dolt +]) diff --git a/build-aux/packages/debian/control.in b/build-aux/packages/debian/control.in new file mode 100644 index 0000000..41c3388 --- /dev/null +++ b/build-aux/packages/debian/control.in @@ -0,0 +1,10 @@ +Source: @PACKAGE_NAME@ +Section: Server +Priority: optional +Maintainer: @PACKAGE_AUTHOR@ <@PACKAGE_AUTHOR_EMAIL@> +Version: @PACKAGE_VERSION_API@ +Package: @PACKAGE_NAME@ +Architecture: any +Depends: @PACKAGE_REQUIRED_RUNTIME@ +Description: @PACKAGE_DESCRIPTION_SHORT@ +@PACKAGE_DESCRIPTION_LONG@ diff --git a/cabrio.spec.in b/cabrio.spec.in new file mode 100644 index 0000000..1876383 --- /dev/null +++ b/cabrio.spec.in @@ -0,0 +1,43 @@ +%{?_with_noconfigure:%define exec_configure 0} +%{!?_with_noconfigure:%define exec_configure 1} + +Summary: @PACKAGE_DESCRIPTION_SHORT@ +Name: @PACKAGE_NAME@ +Provides: @PACKAGE_NAME@ +Version: @PACKAGE_VERSION_API@ +Release: @PACKAGE_VERSION_MINOR_FIX@ +License: GPL +Group: Server +Source0: %{name}-%{version}.tar.bz2 +URL: @PACKAGE_URL@ +Vendor: @PACKAGE_AUTHOR@ <@PACKAGE_AUTHOR_EMAIL@> +Packager: @PACKAGE_AUTHOR@ <@PACKAGE_AUTHOR_EMAIL@> +#BuildArch: i386 +BuildRoot: %{_builddir}/%{name}-root +Requires: @PACKAGE_REQUIRED_RUNTIME@ +BuildRequires: @PACKAGE_REQUIRED_BUILD@ + +%description +@PACKAGE_DESCRIPTION_LONG@ + +%prep +%setup -D -T -n %{name}-root + +%build +%if %{exec_configure} +./configure --prefix=/usr +%endif +make + +%install +make DESTDIR=%{buildroot} install + +#%clean +#rm -rf %{buildroot} + +%files +/ +%defattr(-,root,root,-) +%doc +%changelog + diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..2feb1be --- /dev/null +++ b/configure.ac @@ -0,0 +1,182 @@ + +# Process this file with autoconf to produce a configure script. +AC_PREREQ([2.80]) +AC_INIT(cabrio, 01.00, https://groups.google.com/group/cabrio-fe-dev/) + +AC_CONFIG_MACRO_DIR([build-aux/m4]) +AC_CONFIG_AUX_DIR([build-aux]) + +LT_INIT([dlopen]) + +# find the libltdl sources in the libltdl sub-directory +LT_CONFIG_LTDL_DIR([build-aux/libltdl]) + +LTDL_INIT([recursive]) + +# Include DOLT, libtool faster compiler for something plataforms. +m4_include([build-aux/m4/dolt.m4]) + +# Inicialize DOLT +DOLT + +AM_INIT_AUTOMAKE([1.11 subdir-objects parallel-tests color-tests silent-rules -Wall -Werror]) + +# Silent Build, sample: +# CXX ../cabrio/main.o +AM_SILENT_RULES([yes]) + + +# Information about projet to build packages and the programs. +AC_SUBST([PACKAGE_NAME], ["cabrio"] ) +AC_SUBST([PACKAGE_DESCRIPTION_SHORT], ["A graphical front end for emulators, specifically designed for use in arcade cabinets."] ) +AC_SUBST([PACKAGE_DESCRIPTION_LONG], ["Cabrio is a graphical front end for emulators, specifically designed for use in arcade cabinets. It allows you to select games via an intuitive, attractive interface which is easy to use with limited controls, such as a joystick. Cabrio is made available under the GNU General Public License, meaning anyone can freely download the source code and even contribute to development."] ) +AC_SUBST([PACKAGE_URL], ["http://www.cabrio-fe.org/"] ) + +AC_SUBST([PACKAGE_AUTHOR], ["Steve Maddison"] ) +AC_SUBST([PACKAGE_AUTHOR_EMAIL], ["..."] ) + +AC_SUBST([PACKAGE_REQUIRED_BUILD], ["libavcodec-dev libavutil-dev libavformat-dev libglut3-dev libsdl1.2-dev libsdl-image1.2-dev libsdl-gfx1.2-dev libsdl-mixer1.2-dev libsdl-ttf2.0-dev libswscale-dev libxml2-dev zlib1g-dev"] ) +AC_SUBST([PACKAGE_REQUIRED_RUNTIME], ["libavcodec libavutil libavformat libglut3 libsdl1.2 libsdl-image1.2 libsdl-gfx1.2 libsdl-mixer1.2 libsdl-ttf2.0 libswscale libxml2 zlib1g"] ) + +AC_SUBST([PACKAGE_VERSION_MAJOR], [0]) +AC_SUBST([PACKAGE_VERSION_MINOR], [1]) +AC_SUBST([PACKAGE_VERSION_MINOR_FIX], [0]) + +AC_SUBST([PACKAGE_VERSION_SO], [${PACKAGE_VERSION_MAJOR}:${PACKAGE_VERSION_MINOR}:${PACKAGE_VERSION_MINOR_FIX}]) +AC_SUBST([PACKAGE_VERSION_API], [${PACKAGE_VERSION_MAJOR}.${PACKAGE_VERSION_MINOR}]) + + +# Checks for programs. +AC_PROG_CXX +AC_PROG_CPP +AC_PROG_CC + +# Checks for libraries. + +# Checks for header files. +AC_CHECK_HEADERS([unistd.h]) + +AC_CHECK_HEADER([ltdl.h], + [AC_CHECK_LIB([ltdl],[lt_dladvise_init], + [LIBLTDL=-lltdl], + [LIBLTDL=]) + ],[ + LIBLTDL= + ]) + + +# Checks for typedefs, structures, and compiler characteristics. +AC_HEADER_STDBOOL +AC_TYPE_SIZE_T + +# Checks for library functions. +AC_CHECK_FUNCS([getcwd mkdir socket]) + + +# Set --enable-debug flag. +# If not debug, silent make will be unset. +AC_MSG_CHECKING([Enable debug]) +AC_ARG_ENABLE( + [debug], + AS_HELP_STRING([--enable-debug],[Turn on debugging]), + [ + case "${enableval}" in + yes) debug=true;; + no) debug=false ;; + *) + AC_MSG_RESULT([${enableval}]) + AC_MSG_ERROR([Bad value ${enableval} for --enable-debug]) + ;; + esac + ], + [debug=false] +) +AM_CONDITIONAL([DEBUG], [test x$debug = xtrue]) +AM_COND_IF([DEBUG], + [ + CPPFLAGS="$CPPFLAGS -g -O0 -DDEBUG" + CFLAGS="$CFLAGS -g -O0 -DDEBUG" + LDFLAGS="$LDFLAGS -g -O0 -DDEBUG" + + # Disable silent Build, sample: + # CXX ../cabrio/main.o + AM_SILENT_RULES([no]) + AC_MSG_RESULT([enable]) +],[ + CPPFLAGS="$CPPFLAGS -DNDEBUG" + CFLAGS="$CFLAGS -DNDEBUG" + LDFLAGS="$LDFLAGS -DNDEBUG" + + AC_MSG_RESULT([not enable flags]) +]) + +dnl --------------------------------------------------------------------------- +dnl Turn on (almost) all warnings when using gcc +dnl --------------------------------------------------------------------------- +if test "x$GCC" = "xyes"; then + CPPFLAGS="$CPPFLAGS -Wall" + ## CFLAGS="$CFLAGS --std=c99 -Wall -Wextra -Werror -pedantic" + CFLAGS="$CFLAGS -Wall" + ## CFLAGS="$CFLAGS -Wno-pointer-sign -Wno-unused -Wno-sign-compare" + #CFLAGS="$CFLAGS -Wmissing-declarations -Wmissing-prototypes" + LDFLAGS="$LDFLAGS -Wall" + AC_SUBST([NO_UNUSED_CFLAGS], [-Wno-unused]) +fi + +# Search for dlopen dep. +AC_SEARCH_LIBS([dlopen], [dl dld], [], + [ + AC_MSG_ERROR([unable to find the dlopen() function] + ) +]) + +# Workaroud to show some vars. +abs_builddir=`pwd` +abs_top_builddir=`pwd` +cd $srcdir + +abs_srcdir=`pwd` +abs_top_srcdir=`pwd` +cd $abs_builddir + +# Check and expand install path vars. +if test "x${prefix}" = "xNONE"; then + prefix="${ac_default_prefix}" +fi +if test "x${exec_prefix}" = "xNONE"; then + exec_prefix="${prefix}" +fi +AC_DEFINE_UNQUOTED([PREFIX], "$(eval echo ${prefix})", [Install prefix directory.]) +AC_DEFINE_UNQUOTED([EXEC_PREFIX], ["$(eval echo $exec_prefix)"], [Exec-prefix directory.]) +AC_DEFINE_UNQUOTED([LIBDIR], ["$(eval eval echo $libdir)"], [Library directory.] ) +AC_SUBST( libdir, ["$(eval eval echo $libdir)"]) +AC_SUBST( includedir, ["$(eval eval echo $includedir)"]) +AS_IF([ test "x$pkgsrvdir" = "x" -o "x$pkgsrvdir" = "xNONE" -o "x$pkgsrvdir" = "xnone" ],[ + AC_SUBST( pkgsrvdir, ["$(eval eval echo $localstatedir)/${PACKAGE_NAME}-${PACKAGE_VERSION_MAJOR}"]) +]) + + + +# Add required deps for linker +# Add required deps for compiler +# Add source code include dir for make. The builddir is add here for de case +# of build in another dir, because the *.in files is generate in the builddir. +CPPFLAGS="$CPPFLAGS -I${abs_top_srcdir}/src" +CFLAGS="$CFLAGS -I${abs_top_srcdir}/src" + +CPPFLAGS="$CPPFLAGS -I${abs_top_builddir}/src" +CFLAGS="$CFLAGS -I${abs_top_builddir}/src" + +# Override the template file name of the generated .pc file, so that there +# is no need to rename the template file when the API version changes. +AC_CONFIG_FILES([ + Makefile src/Makefile test/Makefile + src/config.hpp + packages/debian/control + cabrio.spec + ]) + +AC_CONFIG_HEADERS([config.h]) + +AC_OUTPUT + diff --git a/packages/debian/control.in b/packages/debian/control.in new file mode 100644 index 0000000..41c3388 --- /dev/null +++ b/packages/debian/control.in @@ -0,0 +1,10 @@ +Source: @PACKAGE_NAME@ +Section: Server +Priority: optional +Maintainer: @PACKAGE_AUTHOR@ <@PACKAGE_AUTHOR_EMAIL@> +Version: @PACKAGE_VERSION_API@ +Package: @PACKAGE_NAME@ +Architecture: any +Depends: @PACKAGE_REQUIRED_RUNTIME@ +Description: @PACKAGE_DESCRIPTION_SHORT@ +@PACKAGE_DESCRIPTION_LONG@ diff --git a/src/Makefile.am b/src/Makefile.am new file mode 100644 index 0000000..1e1ed9c --- /dev/null +++ b/src/Makefile.am @@ -0,0 +1,22 @@ +## Additional flags to pass to aclocal when it is invoked automatically at +## make time. The ${ACLOCAL_FLAGS} variable is picked up from the environment +## to provide a way for the user to supply additional arguments. +ACLOCAL_AMFLAGS = ${ACLOCAL_FLAGS} + +AUTOMAKE_OPTIONS=subdir-objects -Wall -Werror + +# The name of program appended the version string. +bin_PROGRAMS = cabrio-@PACKAGE_VERSION_API@ + +## Define the source file list for the "@PACKAGE_NAME@-@PACKAGE_VERSION_API@" +## target. Note that @PACKAGE_VERSION_API@ is not interpreted by Automake and +## will therefore be treated as if it were literally part of the target name, +## and the variable name derived from that. +## Note that it is not necessary to list header files +## which are already listed elsewhere in a _HEADERS variable assignment. +cabrio_@PACKAGE_VERSION_API@_SOURCES = bg.c config.c emulator.c focus.c \ + frame.c game_sel.c key.c lookup.c media.c ogl.c platform.c sdl_wrapper.c \ + snap.c submenu.c category.c control.c event.c font.c game.c hint.c \ + location.c menu.c packet.c sdl_ogl.c setup.c sound.c video.c main.c + + diff --git a/bg.c b/src/bg.c similarity index 100% rename from bg.c rename to src/bg.c diff --git a/include/bg.h b/src/bg.h similarity index 100% rename from include/bg.h rename to src/bg.h diff --git a/category.c b/src/category.c similarity index 100% rename from category.c rename to src/category.c diff --git a/include/category.h b/src/category.h similarity index 100% rename from include/category.h rename to src/category.h diff --git a/config.c b/src/config.c similarity index 100% rename from config.c rename to src/config.c diff --git a/include/config.h b/src/config.h similarity index 100% rename from include/config.h rename to src/config.h diff --git a/control.c b/src/control.c similarity index 100% rename from control.c rename to src/control.c diff --git a/include/control.h b/src/control.h similarity index 100% rename from include/control.h rename to src/control.h diff --git a/emulator.c b/src/emulator.c similarity index 100% rename from emulator.c rename to src/emulator.c diff --git a/include/emulator.h b/src/emulator.h similarity index 100% rename from include/emulator.h rename to src/emulator.h diff --git a/event.c b/src/event.c similarity index 100% rename from event.c rename to src/event.c diff --git a/include/event.h b/src/event.h similarity index 100% rename from include/event.h rename to src/event.h diff --git a/focus.c b/src/focus.c similarity index 100% rename from focus.c rename to src/focus.c diff --git a/include/focus.h b/src/focus.h similarity index 100% rename from include/focus.h rename to src/focus.h diff --git a/font.c b/src/font.c similarity index 100% rename from font.c rename to src/font.c diff --git a/include/font.h b/src/font.h similarity index 100% rename from include/font.h rename to src/font.h diff --git a/frame.c b/src/frame.c similarity index 100% rename from frame.c rename to src/frame.c diff --git a/include/frame.h b/src/frame.h similarity index 100% rename from include/frame.h rename to src/frame.h diff --git a/game.c b/src/game.c similarity index 100% rename from game.c rename to src/game.c diff --git a/include/game.h b/src/game.h similarity index 100% rename from include/game.h rename to src/game.h diff --git a/game_sel.c b/src/game_sel.c similarity index 100% rename from game_sel.c rename to src/game_sel.c diff --git a/include/game_sel.h b/src/game_sel.h similarity index 100% rename from include/game_sel.h rename to src/game_sel.h diff --git a/hint.c b/src/hint.c similarity index 100% rename from hint.c rename to src/hint.c diff --git a/include/hint.h b/src/hint.h similarity index 100% rename from include/hint.h rename to src/hint.h diff --git a/key.c b/src/key.c similarity index 100% rename from key.c rename to src/key.c diff --git a/include/key.h b/src/key.h similarity index 100% rename from include/key.h rename to src/key.h diff --git a/location.c b/src/location.c similarity index 100% rename from location.c rename to src/location.c diff --git a/include/location.h b/src/location.h similarity index 100% rename from include/location.h rename to src/location.h diff --git a/lookup.c b/src/lookup.c similarity index 100% rename from lookup.c rename to src/lookup.c diff --git a/include/lookup.h b/src/lookup.h similarity index 100% rename from include/lookup.h rename to src/lookup.h diff --git a/main.c b/src/main.c similarity index 100% rename from main.c rename to src/main.c diff --git a/media.c b/src/media.c similarity index 100% rename from media.c rename to src/media.c diff --git a/include/media.h b/src/media.h similarity index 100% rename from include/media.h rename to src/media.h diff --git a/menu.c b/src/menu.c similarity index 100% rename from menu.c rename to src/menu.c diff --git a/include/menu.h b/src/menu.h similarity index 100% rename from include/menu.h rename to src/menu.h diff --git a/ogl.c b/src/ogl.c similarity index 100% rename from ogl.c rename to src/ogl.c diff --git a/include/ogl.h b/src/ogl.h similarity index 100% rename from include/ogl.h rename to src/ogl.h diff --git a/packet.c b/src/packet.c similarity index 100% rename from packet.c rename to src/packet.c diff --git a/include/packet.h b/src/packet.h similarity index 100% rename from include/packet.h rename to src/packet.h diff --git a/platform.c b/src/platform.c similarity index 100% rename from platform.c rename to src/platform.c diff --git a/include/platform.h b/src/platform.h similarity index 100% rename from include/platform.h rename to src/platform.h diff --git a/sdl_ogl.c b/src/sdl_ogl.c similarity index 100% rename from sdl_ogl.c rename to src/sdl_ogl.c diff --git a/include/sdl_ogl.h b/src/sdl_ogl.h similarity index 100% rename from include/sdl_ogl.h rename to src/sdl_ogl.h diff --git a/sdl_wrapper.c b/src/sdl_wrapper.c similarity index 100% rename from sdl_wrapper.c rename to src/sdl_wrapper.c diff --git a/include/sdl_wrapper.h b/src/sdl_wrapper.h similarity index 100% rename from include/sdl_wrapper.h rename to src/sdl_wrapper.h diff --git a/setup.c b/src/setup.c similarity index 100% rename from setup.c rename to src/setup.c diff --git a/include/setup.h b/src/setup.h similarity index 100% rename from include/setup.h rename to src/setup.h diff --git a/snap.c b/src/snap.c similarity index 100% rename from snap.c rename to src/snap.c diff --git a/include/snap.h b/src/snap.h similarity index 100% rename from include/snap.h rename to src/snap.h diff --git a/sound.c b/src/sound.c similarity index 100% rename from sound.c rename to src/sound.c diff --git a/include/sound.h b/src/sound.h similarity index 100% rename from include/sound.h rename to src/sound.h diff --git a/submenu.c b/src/submenu.c similarity index 100% rename from submenu.c rename to src/submenu.c diff --git a/include/submenu.h b/src/submenu.h similarity index 100% rename from include/submenu.h rename to src/submenu.h diff --git a/video.c b/src/video.c similarity index 100% rename from video.c rename to src/video.c diff --git a/include/video.h b/src/video.h similarity index 100% rename from include/video.h rename to src/video.h diff --git a/test/Makefile.am b/test/Makefile.am new file mode 100644 index 0000000..42504e6 --- /dev/null +++ b/test/Makefile.am @@ -0,0 +1,17 @@ +## Additional flags to pass to aclocal when it is invoked automatically at +## make time. The ${ACLOCAL_FLAGS} variable is picked up from the environment +## to provide a way for the user to supply additional arguments. +ACLOCAL_AMFLAGS = ${ACLOCAL_FLAGS} + +AUTOMAKE_OPTIONS = subdir-objects parallel-tests -Wall -Werror + +#AM_LDFLAGS = -lboost_unit_test_framework $(abs_top_builddir)/src/cabrio-@PACKAGE_VERSION_MAJOR@.la + +TESTS = debug.build default_flags_to_configure.build rpm.build simple.build \ + deb.build + +XFAIL_TESTS = deb.build + +TEST_EXTENSIONS = .build +BUILD_LOG_COMPILER = $(SHELL) $(abs_top_srcdir)/test/build_script $(abs_top_srcdir) $(abs_top_builddir) + diff --git a/test/build_script b/test/build_script new file mode 100644 index 0000000..327c414 --- /dev/null +++ b/test/build_script @@ -0,0 +1,73 @@ +#!/bin/sh -e + +export abs_top_srcdir="${1}" +export abs_top_builddir="${2}" + +shift +shift + +get_option() { + while read OPT_NAME OPT_ARG ; do + if [ "x${OPT_NAME}" = "x${1}" ] ; then + echo "${OPT_ARG}" + return 0; + fi + done <"$2" +} + +MAKE_OPTIONS="` get_option make "$1" `" +CONFIGURE_OPTIONS="` get_option configure "$1" `" +INSTALL_OPTIONS="` get_option install "$1" `" + +echo "[BUILD] Testing build for $1 ..." +TEMP_DIR=` if [ "${abs_top_builddir}" != "${abs_top_srcdir}" ] ; then + mktemp -d -p \`pwd\` +else + mktemp -d +fi +` +( + cp -rf "${abs_top_srcdir}"/* "${TEMP_DIR}"/ + cd "${TEMP_DIR}"/ + make clean + make distclean + rm -rf "${TEMP_DIR}"/config.status +) + +( + cd "${TEMP_DIR}" + + echo "[BUILD] Testing build for $1 : ./configure ${CONFIGURE_OPTIONS}" + ./configure ${CONFIGURE_OPTIONS} || exit 1 + echo "[BUILD] Testing build for $1 : make ${MAKE_OPTIONS}" + make ${MAKE_OPTIONS} || exit 1 + + rm -rf "${TEMP_DIR}" config.status +) + +echo "[BUILD] Testing shadow build for $1 ..." +TEMP_DIR2=` if [ "${abs_top_builddir}" != "${abs_top_srcdir}" ] ; then + mktemp -d -p \`pwd\` +else + mktemp -d +fi +` +( + cp -rf "${abs_top_srcdir}"/ "${TEMP_DIR}"/ + cd "${TEMP_DIR}"/ + make clean + make distclean + rm -rf "${TEMP_DIR}"/config.status +) + +( + cd "${TEMP_DIR2}" + + echo "[BUILD] Testing shadow build for $1 : ${TEMP_DIR}/configure ${CONFIGURE_OPTIONS}" + "${TEMP_DIR}/configure" ${CONFIGURE_OPTIONS} || exit 1 + echo "[BUILD] Testing shadow build for $1 : make ${MAKE_OPTIONS}" + make ${MAKE_OPTIONS} || exit 1 + + rm -rf "${TEMP_DIR}" "${TEMP_DIR2}" +) + diff --git a/test/deb.build b/test/deb.build new file mode 100644 index 0000000..f9ebe93 --- /dev/null +++ b/test/deb.build @@ -0,0 +1,3 @@ +# Test creation of rpm package with make +configure --enable-debug +make pkg-deb diff --git a/test/debug.build b/test/debug.build new file mode 100644 index 0000000..73e23c2 --- /dev/null +++ b/test/debug.build @@ -0,0 +1 @@ +configure --enable-debug diff --git a/test/default_flags_to_configure.build b/test/default_flags_to_configure.build new file mode 100644 index 0000000..20229ef --- /dev/null +++ b/test/default_flags_to_configure.build @@ -0,0 +1,4 @@ +# Build with default arguments for the configure +# this args are generate by autotools +configure --prefix=/usr --exec-prefix=/usr --sysconfdir=/etc/cabrio --bindir=/usr/bin --sbindir=/usr/sbin --libexecdir=/usr/libexec --sharedstatedir=/usr/com --localstatedir=/var --libdir=/usr/lib --includedir=/usr/include --oldincludedir=/usr/include --datarootdir=/usr/share --datadir=/usr/share --infodir=/usr/share/info --localedir=/usr/share/locale --mandir=/usr/share/man --docdir=/usr/share/doc/cabrio --htmldir=/usr/share/doc/cabrio --dvidir=/usr/share/doc/cabrio --pdfdir=/usr/share/doc/cabrio --psdir=/usr/share/doc/cabrio + diff --git a/test/rpm.build b/test/rpm.build new file mode 100644 index 0000000..00d1e02 --- /dev/null +++ b/test/rpm.build @@ -0,0 +1,3 @@ +# Test creation of rpm package with make +configure --enable-debug +make pkg-rpm diff --git a/test/simple.build b/test/simple.build new file mode 100644 index 0000000..05b8a87 --- /dev/null +++ b/test/simple.build @@ -0,0 +1 @@ +# Simple build with default flags From 8dfca16211b6181858575c56518a8e5bc2e4d51d Mon Sep 17 00:00:00 2001 From: psychomantys Date: Fri, 23 Aug 2013 21:55:58 -0300 Subject: [PATCH 02/21] svn removed legacy. --- bootstrap.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bootstrap.sh b/bootstrap.sh index 5cbc277..4815963 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -6,7 +6,7 @@ test -n "${srcdir}" || srcdir=. if [ ! "${NO_CHANGELOG}" ] ; then ( cd "${srcdir}" - svn log > ChangeLog + git log > ChangeLog ) fi From d91c4fc3ae7fe47385fda541a9fc6e2f4b0f7748 Mon Sep 17 00:00:00 2001 From: psychomantys Date: Fri, 23 Aug 2013 23:03:42 -0300 Subject: [PATCH 03/21] Data moved to source directory --- {data => src/data}/fonts/FreeSans.ttf | Bin {data => src/data}/pixmaps/arrow.png | Bin {data => src/data}/pixmaps/button_blue.png | Bin {data => src/data}/pixmaps/button_green.png | Bin {data => src/data}/pixmaps/button_red.png | Bin {data => src/data}/pixmaps/button_white.png | Bin {data => src/data}/pixmaps/button_yellow.png | Bin {data => src/data}/pixmaps/default_background.jpg | Bin {data => src/data}/pixmaps/menu_item.png | Bin {data => src/data}/pixmaps/noise1.png | Bin {data => src/data}/pixmaps/noise2.png | Bin {data => src/data}/pixmaps/noise3.png | Bin {data => src/data}/pixmaps/submenu_item.png | Bin {data => src/data}/sounds/back.wav | Bin {data => src/data}/sounds/blip.wav | Bin {data => src/data}/sounds/no.wav | Bin {data => src/data}/sounds/select.wav | Bin {data => src/data}/themes/carousel/background.jpg | Bin {data => src/data}/themes/carousel/menu-item.png | Bin {data => src/data}/themes/carousel/submenu-item.png | Bin {data => src/data}/themes/carousel/theme.xml | 0 {data => src/data}/themes/ice/arrow.png | Bin {data => src/data}/themes/ice/background.jpg | Bin {data => src/data}/themes/ice/menu-item.png | Bin {data => src/data}/themes/ice/submenu-item.png | Bin {data => src/data}/themes/ice/theme.xml | 0 {data => src/data}/themes/industrial/CREDITS | 0 {data => src/data}/themes/industrial/arrow.png | Bin {data => src/data}/themes/industrial/jet.jpg | Bin {data => src/data}/themes/industrial/menu-item.png | Bin .../data}/themes/industrial/submenu-item.png | Bin {data => src/data}/themes/industrial/theme.xml | 0 {data => src/data}/themes/wood/arrow.png | Bin {data => src/data}/themes/wood/menu-item.png | Bin {data => src/data}/themes/wood/rings.jpg | Bin {data => src/data}/themes/wood/submenu-item.png | Bin {data => src/data}/themes/wood/theme.xml | 0 37 files changed, 0 insertions(+), 0 deletions(-) rename {data => src/data}/fonts/FreeSans.ttf (100%) rename {data => src/data}/pixmaps/arrow.png (100%) rename {data => src/data}/pixmaps/button_blue.png (100%) rename {data => src/data}/pixmaps/button_green.png (100%) rename {data => src/data}/pixmaps/button_red.png (100%) rename {data => src/data}/pixmaps/button_white.png (100%) rename {data => src/data}/pixmaps/button_yellow.png (100%) rename {data => src/data}/pixmaps/default_background.jpg (100%) rename {data => src/data}/pixmaps/menu_item.png (100%) rename {data => src/data}/pixmaps/noise1.png (100%) rename {data => src/data}/pixmaps/noise2.png (100%) rename {data => src/data}/pixmaps/noise3.png (100%) rename {data => src/data}/pixmaps/submenu_item.png (100%) rename {data => src/data}/sounds/back.wav (100%) rename {data => src/data}/sounds/blip.wav (100%) rename {data => src/data}/sounds/no.wav (100%) rename {data => src/data}/sounds/select.wav (100%) rename {data => src/data}/themes/carousel/background.jpg (100%) rename {data => src/data}/themes/carousel/menu-item.png (100%) rename {data => src/data}/themes/carousel/submenu-item.png (100%) rename {data => src/data}/themes/carousel/theme.xml (100%) rename {data => src/data}/themes/ice/arrow.png (100%) rename {data => src/data}/themes/ice/background.jpg (100%) rename {data => src/data}/themes/ice/menu-item.png (100%) rename {data => src/data}/themes/ice/submenu-item.png (100%) rename {data => src/data}/themes/ice/theme.xml (100%) rename {data => src/data}/themes/industrial/CREDITS (100%) rename {data => src/data}/themes/industrial/arrow.png (100%) rename {data => src/data}/themes/industrial/jet.jpg (100%) rename {data => src/data}/themes/industrial/menu-item.png (100%) rename {data => src/data}/themes/industrial/submenu-item.png (100%) rename {data => src/data}/themes/industrial/theme.xml (100%) rename {data => src/data}/themes/wood/arrow.png (100%) rename {data => src/data}/themes/wood/menu-item.png (100%) rename {data => src/data}/themes/wood/rings.jpg (100%) rename {data => src/data}/themes/wood/submenu-item.png (100%) rename {data => src/data}/themes/wood/theme.xml (100%) diff --git a/data/fonts/FreeSans.ttf b/src/data/fonts/FreeSans.ttf similarity index 100% rename from data/fonts/FreeSans.ttf rename to src/data/fonts/FreeSans.ttf diff --git a/data/pixmaps/arrow.png b/src/data/pixmaps/arrow.png similarity index 100% rename from data/pixmaps/arrow.png rename to src/data/pixmaps/arrow.png diff --git a/data/pixmaps/button_blue.png b/src/data/pixmaps/button_blue.png similarity index 100% rename from data/pixmaps/button_blue.png rename to src/data/pixmaps/button_blue.png diff --git a/data/pixmaps/button_green.png b/src/data/pixmaps/button_green.png similarity index 100% rename from data/pixmaps/button_green.png rename to src/data/pixmaps/button_green.png diff --git a/data/pixmaps/button_red.png b/src/data/pixmaps/button_red.png similarity index 100% rename from data/pixmaps/button_red.png rename to src/data/pixmaps/button_red.png diff --git a/data/pixmaps/button_white.png b/src/data/pixmaps/button_white.png similarity index 100% rename from data/pixmaps/button_white.png rename to src/data/pixmaps/button_white.png diff --git a/data/pixmaps/button_yellow.png b/src/data/pixmaps/button_yellow.png similarity index 100% rename from data/pixmaps/button_yellow.png rename to src/data/pixmaps/button_yellow.png diff --git a/data/pixmaps/default_background.jpg b/src/data/pixmaps/default_background.jpg similarity index 100% rename from data/pixmaps/default_background.jpg rename to src/data/pixmaps/default_background.jpg diff --git a/data/pixmaps/menu_item.png b/src/data/pixmaps/menu_item.png similarity index 100% rename from data/pixmaps/menu_item.png rename to src/data/pixmaps/menu_item.png diff --git a/data/pixmaps/noise1.png b/src/data/pixmaps/noise1.png similarity index 100% rename from data/pixmaps/noise1.png rename to src/data/pixmaps/noise1.png diff --git a/data/pixmaps/noise2.png b/src/data/pixmaps/noise2.png similarity index 100% rename from data/pixmaps/noise2.png rename to src/data/pixmaps/noise2.png diff --git a/data/pixmaps/noise3.png b/src/data/pixmaps/noise3.png similarity index 100% rename from data/pixmaps/noise3.png rename to src/data/pixmaps/noise3.png diff --git a/data/pixmaps/submenu_item.png b/src/data/pixmaps/submenu_item.png similarity index 100% rename from data/pixmaps/submenu_item.png rename to src/data/pixmaps/submenu_item.png diff --git a/data/sounds/back.wav b/src/data/sounds/back.wav similarity index 100% rename from data/sounds/back.wav rename to src/data/sounds/back.wav diff --git a/data/sounds/blip.wav b/src/data/sounds/blip.wav similarity index 100% rename from data/sounds/blip.wav rename to src/data/sounds/blip.wav diff --git a/data/sounds/no.wav b/src/data/sounds/no.wav similarity index 100% rename from data/sounds/no.wav rename to src/data/sounds/no.wav diff --git a/data/sounds/select.wav b/src/data/sounds/select.wav similarity index 100% rename from data/sounds/select.wav rename to src/data/sounds/select.wav diff --git a/data/themes/carousel/background.jpg b/src/data/themes/carousel/background.jpg similarity index 100% rename from data/themes/carousel/background.jpg rename to src/data/themes/carousel/background.jpg diff --git a/data/themes/carousel/menu-item.png b/src/data/themes/carousel/menu-item.png similarity index 100% rename from data/themes/carousel/menu-item.png rename to src/data/themes/carousel/menu-item.png diff --git a/data/themes/carousel/submenu-item.png b/src/data/themes/carousel/submenu-item.png similarity index 100% rename from data/themes/carousel/submenu-item.png rename to src/data/themes/carousel/submenu-item.png diff --git a/data/themes/carousel/theme.xml b/src/data/themes/carousel/theme.xml similarity index 100% rename from data/themes/carousel/theme.xml rename to src/data/themes/carousel/theme.xml diff --git a/data/themes/ice/arrow.png b/src/data/themes/ice/arrow.png similarity index 100% rename from data/themes/ice/arrow.png rename to src/data/themes/ice/arrow.png diff --git a/data/themes/ice/background.jpg b/src/data/themes/ice/background.jpg similarity index 100% rename from data/themes/ice/background.jpg rename to src/data/themes/ice/background.jpg diff --git a/data/themes/ice/menu-item.png b/src/data/themes/ice/menu-item.png similarity index 100% rename from data/themes/ice/menu-item.png rename to src/data/themes/ice/menu-item.png diff --git a/data/themes/ice/submenu-item.png b/src/data/themes/ice/submenu-item.png similarity index 100% rename from data/themes/ice/submenu-item.png rename to src/data/themes/ice/submenu-item.png diff --git a/data/themes/ice/theme.xml b/src/data/themes/ice/theme.xml similarity index 100% rename from data/themes/ice/theme.xml rename to src/data/themes/ice/theme.xml diff --git a/data/themes/industrial/CREDITS b/src/data/themes/industrial/CREDITS similarity index 100% rename from data/themes/industrial/CREDITS rename to src/data/themes/industrial/CREDITS diff --git a/data/themes/industrial/arrow.png b/src/data/themes/industrial/arrow.png similarity index 100% rename from data/themes/industrial/arrow.png rename to src/data/themes/industrial/arrow.png diff --git a/data/themes/industrial/jet.jpg b/src/data/themes/industrial/jet.jpg similarity index 100% rename from data/themes/industrial/jet.jpg rename to src/data/themes/industrial/jet.jpg diff --git a/data/themes/industrial/menu-item.png b/src/data/themes/industrial/menu-item.png similarity index 100% rename from data/themes/industrial/menu-item.png rename to src/data/themes/industrial/menu-item.png diff --git a/data/themes/industrial/submenu-item.png b/src/data/themes/industrial/submenu-item.png similarity index 100% rename from data/themes/industrial/submenu-item.png rename to src/data/themes/industrial/submenu-item.png diff --git a/data/themes/industrial/theme.xml b/src/data/themes/industrial/theme.xml similarity index 100% rename from data/themes/industrial/theme.xml rename to src/data/themes/industrial/theme.xml diff --git a/data/themes/wood/arrow.png b/src/data/themes/wood/arrow.png similarity index 100% rename from data/themes/wood/arrow.png rename to src/data/themes/wood/arrow.png diff --git a/data/themes/wood/menu-item.png b/src/data/themes/wood/menu-item.png similarity index 100% rename from data/themes/wood/menu-item.png rename to src/data/themes/wood/menu-item.png diff --git a/data/themes/wood/rings.jpg b/src/data/themes/wood/rings.jpg similarity index 100% rename from data/themes/wood/rings.jpg rename to src/data/themes/wood/rings.jpg diff --git a/data/themes/wood/submenu-item.png b/src/data/themes/wood/submenu-item.png similarity index 100% rename from data/themes/wood/submenu-item.png rename to src/data/themes/wood/submenu-item.png diff --git a/data/themes/wood/theme.xml b/src/data/themes/wood/theme.xml similarity index 100% rename from data/themes/wood/theme.xml rename to src/data/themes/wood/theme.xml From 3b3db88ef2ab3d08793ffbed69a1bc9ba7eadfb1 Mon Sep 17 00:00:00 2001 From: psychomantys Date: Fri, 23 Aug 2013 23:08:43 -0300 Subject: [PATCH 04/21] Small fix to autotools build. Makefile: Not use anymore. --- Makefile | 45 --------------------------------------------- bootstrap.sh | 2 +- configure.ac | 33 +++++++-------------------------- src/Makefile.am | 7 +++++++ src/config.c | 19 ++++++++++--------- 5 files changed, 25 insertions(+), 81 deletions(-) delete mode 100644 Makefile diff --git a/Makefile b/Makefile deleted file mode 100644 index 63e628f..0000000 --- a/Makefile +++ /dev/null @@ -1,45 +0,0 @@ -CC=gcc -BIN_DIR=/usr/bin -DATA_DIR=/usr/share/cabrio -CFLAGS=-g -Wall -DDATA_DIR=\"$(DATA_DIR)\" -LDFLAGS=-lGL -lSDL -lSDL_image -lSDL_gfx -lSDL_ttf -lSDL_mixer -lGLU -lxml2 \ - -lavutil -lavformat -lavcodec -lswscale -INCLUDES=-I./include -I/usr/include/libxml2 - -INSTALL=/usr/bin/install -c - -cabrio: main.o ogl.o sdl_wrapper.o config.o bg.o menu.o game_sel.o \ - game.o font.o hint.o platform.o submenu.o \ - sound.o event.o key.o control.o setup.o sdl_ogl.o video.o packet.o frame.o \ - category.o focus.o emulator.o snap.o media.o location.o lookup.o - $(CC) -o $@ $^ $(LDFLAGS) - -.c.o: %.c - $(CC) $(CFLAGS) $(INCLUDES) -o $@ -c $< - -install: cabrio - $(INSTALL) -m 755 -d $(DATA_DIR)/fonts $(DATA_DIR)/pixmaps $(DATA_DIR)/sounds - $(INSTALL) -m 644 -t $(DATA_DIR)/fonts data/fonts/* - $(INSTALL) -m 644 -t $(DATA_DIR)/pixmaps data/pixmaps/* - $(INSTALL) -m 644 -t $(DATA_DIR)/sounds data/sounds/* - $(INSTALL) -m 755 -d $(DATA_DIR)/themes - $(INSTALL) -m 755 -d $(DATA_DIR)/themes/carousel - $(INSTALL) -m 644 -t $(DATA_DIR)/themes/carousel data/themes/carousel/* - $(INSTALL) -m 755 -d $(DATA_DIR)/themes/ice - $(INSTALL) -m 644 -t $(DATA_DIR)/themes/ice data/themes/ice/* - $(INSTALL) -m 755 -d $(DATA_DIR)/themes/industrial - $(INSTALL) -m 644 -t $(DATA_DIR)/themes/industrial data/themes/industrial/* - $(INSTALL) -m 755 -d $(DATA_DIR)/themes/wood - $(INSTALL) -m 644 -t $(DATA_DIR)/themes/wood data/themes/wood/* - $(INSTALL) -m 755 -d $(BIN_DIR) - $(INSTALL) -m 755 -t $(BIN_DIR) cabrio - -deb: - debuild -i -us -uc -b - -debclean: - debuild clean - -clean: - rm -f cabrio *.o core core.* - diff --git a/bootstrap.sh b/bootstrap.sh index 4815963..2c04908 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -10,7 +10,7 @@ if [ ! "${NO_CHANGELOG}" ] ; then ) fi -libtoolize --ltdl +#libtoolize --ltdl autoreconf --force --install --verbose "$srcdir" test -n "${NOCONFIGURE}" || "${srcdir}/configure" "$@" #test -n "${NOCONFIGURE}" || "${srcdir}/configure" --enable-silent-rules --disable-dependency-tracking "$@" diff --git a/configure.ac b/configure.ac index 2feb1be..40f6502 100644 --- a/configure.ac +++ b/configure.ac @@ -1,25 +1,12 @@ # Process this file with autoconf to produce a configure script. -AC_PREREQ([2.80]) +#AC_PREREQ([2.80]) AC_INIT(cabrio, 01.00, https://groups.google.com/group/cabrio-fe-dev/) AC_CONFIG_MACRO_DIR([build-aux/m4]) AC_CONFIG_AUX_DIR([build-aux]) -LT_INIT([dlopen]) - -# find the libltdl sources in the libltdl sub-directory -LT_CONFIG_LTDL_DIR([build-aux/libltdl]) - -LTDL_INIT([recursive]) - -# Include DOLT, libtool faster compiler for something plataforms. -m4_include([build-aux/m4/dolt.m4]) - -# Inicialize DOLT -DOLT - -AM_INIT_AUTOMAKE([1.11 subdir-objects parallel-tests color-tests silent-rules -Wall -Werror]) +AM_INIT_AUTOMAKE([foreign subdir-objects parallel-tests color-tests silent-rules -Wall -Werror]) # Silent Build, sample: # CXX ../cabrio/main.o @@ -52,19 +39,11 @@ AC_PROG_CPP AC_PROG_CC # Checks for libraries. +PKG_CHECK_MODULES(libxml2, libxml-2.0) # Checks for header files. AC_CHECK_HEADERS([unistd.h]) -AC_CHECK_HEADER([ltdl.h], - [AC_CHECK_LIB([ltdl],[lt_dladvise_init], - [LIBLTDL=-lltdl], - [LIBLTDL=]) - ],[ - LIBLTDL= - ]) - - # Checks for typedefs, structures, and compiler characteristics. AC_HEADER_STDBOOL AC_TYPE_SIZE_T @@ -149,6 +128,8 @@ fi AC_DEFINE_UNQUOTED([PREFIX], "$(eval echo ${prefix})", [Install prefix directory.]) AC_DEFINE_UNQUOTED([EXEC_PREFIX], ["$(eval echo $exec_prefix)"], [Exec-prefix directory.]) AC_DEFINE_UNQUOTED([LIBDIR], ["$(eval eval echo $libdir)"], [Library directory.] ) +AC_DEFINE_UNQUOTED([DATADIR], ["$(eval eval echo $datadir)"], [Data directory.] ) +AC_DEFINE_UNQUOTED([PACKAGE_DATA_DIR], ["$(eval eval echo ${datadir}/${PACKAGE_NAME})"], [Data directory.] ) AC_SUBST( libdir, ["$(eval eval echo $libdir)"]) AC_SUBST( includedir, ["$(eval eval echo $includedir)"]) AS_IF([ test "x$pkgsrvdir" = "x" -o "x$pkgsrvdir" = "xNONE" -o "x$pkgsrvdir" = "xnone" ],[ @@ -171,12 +152,12 @@ CFLAGS="$CFLAGS -I${abs_top_builddir}/src" # is no need to rename the template file when the API version changes. AC_CONFIG_FILES([ Makefile src/Makefile test/Makefile - src/config.hpp packages/debian/control cabrio.spec ]) +# src/config.hpp -AC_CONFIG_HEADERS([config.h]) +AC_CONFIG_HEADERS([src/envs.h]) AC_OUTPUT diff --git a/src/Makefile.am b/src/Makefile.am index 1e1ed9c..5e3e3e0 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -5,9 +5,15 @@ ACLOCAL_AMFLAGS = ${ACLOCAL_FLAGS} AUTOMAKE_OPTIONS=subdir-objects -Wall -Werror + # The name of program appended the version string. bin_PROGRAMS = cabrio-@PACKAGE_VERSION_API@ + + +cabrio_@PACKAGE_VERSION_API@_CFLAGS = $(libxml2_CFLAGS) +cabrio_@PACKAGE_VERSION_API@_LDADD = $(libxml2_LIBS) + ## Define the source file list for the "@PACKAGE_NAME@-@PACKAGE_VERSION_API@" ## target. Note that @PACKAGE_VERSION_API@ is not interpreted by Automake and ## will therefore be treated as if it were literally part of the target name, @@ -19,4 +25,5 @@ cabrio_@PACKAGE_VERSION_API@_SOURCES = bg.c config.c emulator.c focus.c \ snap.c submenu.c category.c control.c event.c font.c game.c hint.c \ location.c menu.c packet.c sdl_ogl.c setup.c sound.c video.c main.c +dist_data_DATA = data/fonts/ data/pixmaps/ data/sounds/ data/themes/ diff --git a/src/config.c b/src/config.c index 2eb33c8..5895082 100644 --- a/src/config.c +++ b/src/config.c @@ -15,6 +15,7 @@ #include "event.h" #include "control.h" #include "sound.h" +#include "envs.h" #include #include @@ -2203,7 +2204,7 @@ int config_new( void ) { strncpy( default_theme.directory, "", CONFIG_FILE_NAME_LENGTH ); strncpy( default_theme.name, default_theme_name, CONFIG_NAME_LENGTH ); - snprintf( default_theme.menu.texture, CONFIG_FILE_NAME_LENGTH, "%s%s", DATA_DIR, default_menu_texture ); + snprintf( default_theme.menu.texture, CONFIG_FILE_NAME_LENGTH, "%s%s", PACKAGE_DATA_DIR, default_menu_texture ); default_theme.menu.item_width = 1; default_theme.menu.item_height = 0.6; default_theme.menu.font_scale = 1; @@ -2217,18 +2218,18 @@ int config_new( void ) { default_theme.menu.auto_hide = 0; default_theme.menu.border = 10; - snprintf( default_theme.submenu.texture, CONFIG_FILE_NAME_LENGTH, "%s%s", DATA_DIR, default_submenu_texture ); + snprintf( default_theme.submenu.texture, CONFIG_FILE_NAME_LENGTH, "%s%s", PACKAGE_DATA_DIR, default_submenu_texture ); default_theme.submenu.item_width = 1; default_theme.submenu.item_height = 0.25; default_theme.submenu.font_scale = 1; default_theme.submenu.offset1 = -0.3; default_theme.submenu.offset2 = 0.0; - snprintf( default_theme.background_image, CONFIG_FILE_NAME_LENGTH, "%s%s", DATA_DIR, default_background ); + snprintf( default_theme.background_image, CONFIG_FILE_NAME_LENGTH, "%s%s", PACKAGE_DATA_DIR, default_background ); default_theme.background_rotation = 20; default_theme.background_transparency = 30; - snprintf( default_theme.font_file, CONFIG_FILE_NAME_LENGTH, "%s%s", DATA_DIR, default_font ); + snprintf( default_theme.font_file, CONFIG_FILE_NAME_LENGTH, "%s%s", PACKAGE_DATA_DIR, default_font ); default_theme.font_size = 50; default_theme.font_rgb.red = 255; default_theme.font_rgb.green = 255; @@ -2249,9 +2250,9 @@ int config_new( void ) { default_theme.hints.size = 1; default_theme.hints.pulse = 1; default_theme.hints.spacing = 0; - snprintf( default_theme.hints.image_back, CONFIG_FILE_NAME_LENGTH, "%s%s", DATA_DIR, default_back_texture ); - snprintf( default_theme.hints.image_select, CONFIG_FILE_NAME_LENGTH, "%s%s", DATA_DIR, default_select_texture ); - snprintf( default_theme.hints.image_arrow, CONFIG_FILE_NAME_LENGTH, "%s%s", DATA_DIR, default_arrow_texture ); + snprintf( default_theme.hints.image_back, CONFIG_FILE_NAME_LENGTH, "%s%s", PACKAGE_DATA_DIR, default_back_texture ); + snprintf( default_theme.hints.image_select, CONFIG_FILE_NAME_LENGTH, "%s%s", PACKAGE_DATA_DIR, default_select_texture ); + snprintf( default_theme.hints.image_arrow, CONFIG_FILE_NAME_LENGTH, "%s%s", PACKAGE_DATA_DIR, default_arrow_texture ); default_theme.game_sel.orientation = CONFIG_PORTRAIT; default_theme.game_sel.offset1 = 0.9; @@ -2287,7 +2288,7 @@ int config_new( void ) { } for( i = 0 ; i < NUM_SOUNDS ; i++ ) { - snprintf( default_theme.sounds[i], CONFIG_FILE_NAME_LENGTH, "%s%s", DATA_DIR, (char*)default_sounds[i] ); + snprintf( default_theme.sounds[i], CONFIG_FILE_NAME_LENGTH, "%s%s", PACKAGE_DATA_DIR, (char*)default_sounds[i] ); } config.themes = &default_theme; @@ -2473,7 +2474,7 @@ int config_open( const char *filename ) { } config_load_themes( config_directory ); - config_load_themes( DATA_DIR ); + config_load_themes( PACKAGE_DATA_DIR ); /* We now have our entire configuration, so the theming may begin... */ config_set_theme(); From d4f02dfee900c0d5933a6b2d0f19b5d8dce803b9 Mon Sep 17 00:00:00 2001 From: psychomantys Date: Fri, 23 Aug 2013 23:10:49 -0300 Subject: [PATCH 05/21] dolt is not used, deleted. --- build-aux/m4/dolt.m4 | 177 ------------------------------------------- 1 file changed, 177 deletions(-) delete mode 100644 build-aux/m4/dolt.m4 diff --git a/build-aux/m4/dolt.m4 b/build-aux/m4/dolt.m4 deleted file mode 100644 index 177abb3..0000000 --- a/build-aux/m4/dolt.m4 +++ /dev/null @@ -1,177 +0,0 @@ -dnl dolt, a replacement for libtool -dnl Copyright © 2007-2010 Josh Triplett -dnl Copying and distribution of this file, with or without modification, -dnl are permitted in any medium without royalty provided the copyright -dnl notice and this notice are preserved. -dnl -dnl To use dolt, invoke the DOLT macro immediately after the libtool macros. -dnl Optionally, copy this file into acinclude.m4, to avoid the need to have it -dnl installed when running autoconf on your project. - -AC_DEFUN([DOLT], [ -AC_REQUIRE([AC_CANONICAL_HOST]) -# dolt, a replacement for libtool -# Josh Triplett -AC_PATH_PROG(DOLT_BASH, bash) -AC_MSG_CHECKING([if dolt supports this host]) -dolt_supported=yes -if test x$DOLT_BASH = x; then - dolt_supported=no -fi -if test x$GCC != xyes; then - dolt_supported=no -fi -case $host in -i?86-*-linux*|x86_64-*-linux*|powerpc-*-linux*|sparc*-*-linux* \ -|amd64-*-freebsd*|i?86-*-freebsd*|ia64-*-freebsd*) - pic_options='-fPIC' - ;; -i?86-apple-darwin*) - pic_options='-fno-common' - ;; -*) - dolt_supported=no - ;; -esac -if test x$dolt_supported = xno ; then - AC_MSG_RESULT([no, falling back to libtool]) - LTCOMPILE='$(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(COMPILE)' - LTCXXCOMPILE='$(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXXCOMPILE)' -else - AC_MSG_RESULT([yes, replacing libtool]) - -dnl Start writing out doltcompile. - cat <<__DOLTCOMPILE__EOF__ >doltcompile -#!$DOLT_BASH -__DOLTCOMPILE__EOF__ - cat <<'__DOLTCOMPILE__EOF__' >>doltcompile -args=("$[]@") -for ((arg=0; arg<${#args@<:@@@:>@}; arg++)) ; do - if test x"${args@<:@$arg@:>@}" = x-o ; then - objarg=$((arg+1)) - break - fi -done -if test x$objarg = x ; then - echo 'Error: no -o on compiler command line' 1>&2 - exit 1 -fi -lo="${args@<:@$objarg@:>@}" -obj="${lo%.lo}" -if test x"$lo" = x"$obj" ; then - echo "Error: libtool object file name \"$lo\" does not end in .lo" 1>&2 - exit 1 -fi -objbase="${obj##*/}" -__DOLTCOMPILE__EOF__ - -dnl Write out shared compilation code. - if test x$enable_shared = xyes; then - cat <<'__DOLTCOMPILE__EOF__' >>doltcompile -libobjdir="${obj%$objbase}.libs" -if test ! -d "$libobjdir" ; then - mkdir_out="$(mkdir "$libobjdir" 2>&1)" - mkdir_ret=$? - if test "$mkdir_ret" -ne 0 && test ! -d "$libobjdir" ; then - echo "$mkdir_out" 1>&2 - exit $mkdir_ret - fi -fi -pic_object="$libobjdir/$objbase.o" -args@<:@$objarg@:>@="$pic_object" -__DOLTCOMPILE__EOF__ - cat <<__DOLTCOMPILE__EOF__ >>doltcompile -"\${args@<:@@@:>@}" $pic_options -DPIC || exit \$? -__DOLTCOMPILE__EOF__ - fi - -dnl Write out static compilation code. -dnl Avoid duplicate compiler output if also building shared objects. - if test x$enable_static = xyes; then - cat <<'__DOLTCOMPILE__EOF__' >>doltcompile -non_pic_object="$obj.o" -args@<:@$objarg@:>@="$non_pic_object" -__DOLTCOMPILE__EOF__ - if test x$enable_shared = xyes; then - cat <<'__DOLTCOMPILE__EOF__' >>doltcompile -"${args@<:@@@:>@}" >/dev/null 2>&1 || exit $? -__DOLTCOMPILE__EOF__ - else - cat <<'__DOLTCOMPILE__EOF__' >>doltcompile -"${args@<:@@@:>@}" || exit $? -__DOLTCOMPILE__EOF__ - fi - fi - -dnl Write out the code to write the .lo file. -dnl The second line of the .lo file must match "^# Generated by .*libtool" - cat <<'__DOLTCOMPILE__EOF__' >>doltcompile -{ -echo "# $lo - a libtool object file" -echo "# Generated by doltcompile, not libtool" -__DOLTCOMPILE__EOF__ - - if test x$enable_shared = xyes; then - cat <<'__DOLTCOMPILE__EOF__' >>doltcompile -echo "pic_object='.libs/${objbase}.o'" -__DOLTCOMPILE__EOF__ - else - cat <<'__DOLTCOMPILE__EOF__' >>doltcompile -echo pic_object=none -__DOLTCOMPILE__EOF__ - fi - - if test x$enable_static = xyes; then - cat <<'__DOLTCOMPILE__EOF__' >>doltcompile -echo "non_pic_object='${objbase}.o'" -__DOLTCOMPILE__EOF__ - else - cat <<'__DOLTCOMPILE__EOF__' >>doltcompile -echo non_pic_object=none -__DOLTCOMPILE__EOF__ - fi - - cat <<'__DOLTCOMPILE__EOF__' >>doltcompile -} > "$lo" -__DOLTCOMPILE__EOF__ - -dnl Done writing out doltcompile; substitute it for libtool compilation. - chmod +x doltcompile - LTCOMPILE='$(top_builddir)/doltcompile $(COMPILE)' - LTCXXCOMPILE='$(top_builddir)/doltcompile $(CXXCOMPILE)' - -dnl automake ignores LTCOMPILE and LTCXXCOMPILE when it has separate CFLAGS for -dnl a target, so write out a libtool wrapper to handle that case. -dnl Note that doltlibtool does not handle inferred tags or option arguments -dnl without '=', because automake does not use them. - cat <<__DOLTLIBTOOL__EOF__ > doltlibtool -#!$DOLT_BASH -__DOLTLIBTOOL__EOF__ - cat <<'__DOLTLIBTOOL__EOF__' >>doltlibtool -top_builddir_slash="${0%%doltlibtool}" -: ${top_builddir_slash:=./} -args=() -modeok=false -tagok=false -for arg in "$[]@"; do - case "$arg" in - --mode=compile) modeok=true ;; - --tag=CC|--tag=CXX) tagok=true ;; - *) args@<:@${#args[@]}@:>@="$arg" ;; - esac -done -if $modeok && $tagok ; then - . ${top_builddir_slash}doltcompile "${args@<:@@@:>@}" -else - exec ${top_builddir_slash}libtool "$[]@" -fi -__DOLTLIBTOOL__EOF__ - -dnl Done writing out doltlibtool; substitute it for libtool. - chmod +x doltlibtool - LIBTOOL='$(top_builddir)/doltlibtool' -fi -AC_SUBST(LTCOMPILE) -AC_SUBST(LTCXXCOMPILE) -# end dolt -]) From 70882c17acda5fde41974cb5f7528388b268eafc Mon Sep 17 00:00:00 2001 From: psychomantys Date: Sat, 24 Aug 2013 03:19:29 -0300 Subject: [PATCH 06/21] Autotools works now! Tests and leave best the scripts. README moved because new markdown README end whit *.md. --- README => README.md | 0 configure.ac | 16 ++++++++++++++++ src/Makefile.am | 13 +++++++++++-- 3 files changed, 27 insertions(+), 2 deletions(-) rename README => README.md (100%) diff --git a/README b/README.md similarity index 100% rename from README rename to README.md diff --git a/configure.ac b/configure.ac index 40f6502..60f5651 100644 --- a/configure.ac +++ b/configure.ac @@ -39,7 +39,23 @@ AC_PROG_CPP AC_PROG_CC # Checks for libraries. + PKG_CHECK_MODULES(libxml2, libxml-2.0) +# SDL +PKG_CHECK_MODULES(SDL, sdl) +PKG_CHECK_MODULES(SDL_ttf, SDL_ttf) +PKG_CHECK_MODULES(SDL_gfx, SDL_gfx) +PKG_CHECK_MODULES(SDL_image, SDL_image) +PKG_CHECK_MODULES(SDL_mixer, SDL_mixer) +# ffmpeg +PKG_CHECK_MODULES(libavformat, libavformat) +PKG_CHECK_MODULES(libavutil, libavutil) +PKG_CHECK_MODULES(libavcodec, libavcodec) +PKG_CHECK_MODULES(libswscale, libswscale) +PKG_CHECK_MODULES(libavdevice, libavdevice) +# openGL +PKG_CHECK_MODULES(GL, gl) +PKG_CHECK_MODULES(GLU, glu) # Checks for header files. AC_CHECK_HEADERS([unistd.h]) diff --git a/src/Makefile.am b/src/Makefile.am index 5e3e3e0..426c398 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -11,8 +11,17 @@ bin_PROGRAMS = cabrio-@PACKAGE_VERSION_API@ -cabrio_@PACKAGE_VERSION_API@_CFLAGS = $(libxml2_CFLAGS) -cabrio_@PACKAGE_VERSION_API@_LDADD = $(libxml2_LIBS) +cabrio_@PACKAGE_VERSION_API@_CFLAGS = $(libxml2_CFLAGS) $(SDL_CFLAGS) \ + $(SDL_ttf_CFLAGS) $(SDL_gfx_CFLAGS) $(SDL_image_CFLAGS) \ + $(SDL_mixer_CFLAGS) $(libavdevice_CFLAGS) $(libavformat_CFLAGS) \ + $(libavutil_CFLAGS) $(libavcodec_CFLAGS) $(GL_CFLAGS) $(GLU_CFLAGS) \ + $(libswscale_CFLAGS) + +cabrio_@PACKAGE_VERSION_API@_LDADD = $(libxml2_LIBS) $(SDL_LIBS) \ + $(libavdevice_LIBS) $(SDL_ttf_LIBS) $(SDL_gfx_LIBS) $(SDL_image_LIBS) \ + $(SDL_mixer_LIBS) $(libavformat_LIBS) $(libavutil_LIBS) \ + $(libavcodec_LIBS) $(libswscale_LIBS) $(GL_LIBS) $(GLU_LIBS) + ## Define the source file list for the "@PACKAGE_NAME@-@PACKAGE_VERSION_API@" ## target. Note that @PACKAGE_VERSION_API@ is not interpreted by Automake and From 24c758ef362286fe751eee8fbd59c7e75c9ac627 Mon Sep 17 00:00:00 2001 From: psychomantys Date: Sat, 24 Aug 2013 03:36:16 -0300 Subject: [PATCH 07/21] Fix compile with new ffmpeg version --- src/frame.c | 1 - src/frame.h | 2 ++ src/packet.h | 2 ++ src/snap.c | 7 ++++--- src/video.c | 20 ++++++++++++++++---- src/video.h | 4 ---- 6 files changed, 24 insertions(+), 12 deletions(-) diff --git a/src/frame.c b/src/frame.c index 19d84a7..738fa47 100644 --- a/src/frame.c +++ b/src/frame.c @@ -2,7 +2,6 @@ #include "frame.h" #include "video.h" - void frame_queue_init( struct frame_queue *q ) { memset( q, 0, sizeof(struct frame_queue) ); q->mutex = SDL_CreateMutex(); diff --git a/src/frame.h b/src/frame.h index 1aa0663..a22cfa0 100644 --- a/src/frame.h +++ b/src/frame.h @@ -4,6 +4,8 @@ #include #include "video.h" +#include + struct frame_list { struct frame_list *next; struct frame_list *prev; diff --git a/src/packet.h b/src/packet.h index 9103c65..565bae1 100644 --- a/src/packet.h +++ b/src/packet.h @@ -4,6 +4,8 @@ #include #include "video.h" +#include + struct packet_queue { AVPacketList *first; AVPacketList *last; diff --git a/src/snap.c b/src/snap.c index cbe12d7..dcfdd24 100644 --- a/src/snap.c +++ b/src/snap.c @@ -1,3 +1,4 @@ +#include "envs.h" #include "snap.h" #include "game.h" #include "config.h" @@ -31,9 +32,9 @@ static int width, height; int snap_init( void ) { const struct config *config = config_get(); int i; - noise[0] = sdl_create_texture( DATA_DIR "/pixmaps/noise1.png" ); - noise[1] = sdl_create_texture( DATA_DIR "/pixmaps/noise2.png" ); - noise[2] = sdl_create_texture( DATA_DIR "/pixmaps/noise3.png" ); + noise[0] = sdl_create_texture( PACKAGE_DATA_DIR "/pixmaps/noise1.png" ); + noise[1] = sdl_create_texture( PACKAGE_DATA_DIR "/pixmaps/noise2.png" ); + noise[2] = sdl_create_texture( PACKAGE_DATA_DIR "/pixmaps/noise3.png" ); if( noise[0] == NULL || noise[1] == NULL || noise[2] == NULL ) { fprintf( stderr, "Warning: Couldn't create texture for snap noise\n" ); diff --git a/src/video.c b/src/video.c index 8a30700..beb6176 100644 --- a/src/video.c +++ b/src/video.c @@ -6,6 +6,11 @@ #include #include + +#include +#include +#include + #include "video.h" #include "sound.h" #include "packet.h" @@ -73,7 +78,10 @@ int video_init( void ) { packet_queue_init( &audio_queue ); frame_queue_init( &video_queue ); - url_set_interrupt_cb( video_stopped ); +// avio_set_interrupt_cb( video_stopped ); +// url_set_interrupt_cb( video_stopped ); +// const AVIOInterruptCB int_cb = { decode_interrupt_cb, NULL }; +// avio_set_interrupt_cb( video_stopped ); return 0; } @@ -300,12 +308,16 @@ int video_open( const char *filename ) { audio_buffer_size = 0; audio_buffer_index = 0; - av_init_packet(&audio_packet); + av_init_packet(&audio_packet); if( !filename ) return -1; - - if( av_open_input_file( &format_context, filename, NULL, 0, NULL ) != 0 ) { + + const AVIOInterruptCB int_cb = { video_stopped, NULL }; + format_context->interrupt_callback=int_cb; + + if( avio_open2( &format_context->pb, filename, NULL, &format_context->interrupt_callback, NULL) != 0 ){ +// if( av_open_input_file( &format_context, filename, NULL, 0, NULL ) != 0 ) { fprintf( stderr, "Warning: Error opening video file '%s'\n", filename ); return -1; } diff --git a/src/video.h b/src/video.h index 7382cf7..9db1a9d 100644 --- a/src/video.h +++ b/src/video.h @@ -1,10 +1,6 @@ #ifndef __VIDEO_H__ #define __VIDEO_H__ -#include -#include -#include - int video_init( void ); void video_free( void ); int video_open( const char *filename ); From 93578e393c07ed821d1ecd78b55be2eb2809fe6a Mon Sep 17 00:00:00 2001 From: psychomantys Date: Sat, 24 Aug 2013 04:02:57 -0300 Subject: [PATCH 08/21] small warnings fix. --- src/config.c | 4 ++-- src/packet.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/config.c b/src/config.c index 5895082..d354b25 100644 --- a/src/config.c +++ b/src/config.c @@ -2135,7 +2135,7 @@ int config_new( void ) { else { int i; struct config_param *prev_param = NULL; - struct config_category *platform_catgeory; + struct config_category *platform_category; const int num_params = 4; const char *params[] = { "-nowindow", "-skip_gameinfo", "-switchres", "-joystick" }; const char *keys[] = { @@ -2192,7 +2192,7 @@ int config_new( void ) { config.iface.prune_menus = 1; /* Ensure the game list category has id 0 - we need to track it later */ - platform_catgeory = config_category( default_label_lists ); + platform_category = config_category( default_label_lists ); strncpy( config.iface.labels.label_all, default_label_all, CONFIG_LABEL_LENGTH ); strncpy( config.iface.labels.label_platform, default_label_platform, CONFIG_LABEL_LENGTH ); strncpy( config.iface.labels.label_back, default_label_back, CONFIG_LABEL_LENGTH ); diff --git a/src/packet.c b/src/packet.c index fe3054e..c19a7c2 100644 --- a/src/packet.c +++ b/src/packet.c @@ -44,7 +44,7 @@ int packet_queue_put( struct packet_queue *q, AVPacket *p ) { int packet_queue_get( struct packet_queue *q, AVPacket *p, int block ) { AVPacketList *packet; - int ret; + int ret=1; SDL_LockMutex( q->mutex ); From 439beb9305e9f22ad5d2d421853e54d04eecab06 Mon Sep 17 00:00:00 2001 From: psychomantys Date: Sun, 25 Aug 2013 02:04:48 -0300 Subject: [PATCH 09/21] Fix build tests. --- Makefile.am | 10 +++++----- src/Makefile.am | 7 ++++++- test/Makefile.am | 2 +- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/Makefile.am b/Makefile.am index 95e25e1..7f739f0 100644 --- a/Makefile.am +++ b/Makefile.am @@ -46,15 +46,15 @@ pkg-rpm: all mkdir -p $(TEMP_PKG_RPM_DIR)/BUILD mkdir -p $(TEMP_PKG_RPM_DIR)/SOURCES mkdir -p $(TEMP_PKG_RPM_DIR)/tmp - @- rm -r $(TEMP_PKG_RPM_DIR)/BUILD/$(PACKAGE_NAME)-root + @- rm -rf $(TEMP_PKG_RPM_DIR)/BUILD/$(PACKAGE_NAME)-root @- ln -s $(abs_top_builddir) $(TEMP_PKG_RPM_DIR)/BUILD/$(PACKAGE_NAME)-root - @- rm -r $(TEMP_PKG_RPM_DIR)/RPMS/$(PACKAGE_NAME)-* - @- rm -r $(TEMP_PKG_RPM_DIR)/SRPMS/$(PACKAGE_NAME)-* - @- rm -r $(TEMP_PKG_RPM_DIR)/SOURCES/$(PACKAGE_NAME)-* + @- rm -rf $(TEMP_PKG_RPM_DIR)/RPMS/$(PACKAGE_NAME)-* + @- rm -rf $(TEMP_PKG_RPM_DIR)/SRPMS/$(PACKAGE_NAME)-* + @- rm -rf $(TEMP_PKG_RPM_DIR)/SOURCES/$(PACKAGE_NAME)-* # Find binary deps for binary in $(abs_top_builddir) to write in rpm # deps in cabrio.spec - sed -i s/"^Requires: .*/Requires: ` ( find $(abs_top_builddir) -not -type d \ + sed -i s/"^Requires: /Requires: ` ( find $(abs_top_builddir) -not -type d \ | xargs -n1 objdump -p | grep 'NEEDED ' \ | tr -s ' ' |cut -f 3 -d ' ' | sort -u \ | xargs -n 1 printf -- " -e %s" \ diff --git a/src/Makefile.am b/src/Makefile.am index 426c398..0de2643 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -34,5 +34,10 @@ cabrio_@PACKAGE_VERSION_API@_SOURCES = bg.c config.c emulator.c focus.c \ snap.c submenu.c category.c control.c event.c font.c game.c hint.c \ location.c menu.c packet.c sdl_ogl.c setup.c sound.c video.c main.c -dist_data_DATA = data/fonts/ data/pixmaps/ data/sounds/ data/themes/ +install-data-local: + $(mkinstalldirs) $(DESTDIR)$(pkgdatadir)/ + @for f in ${abs_top_srcdir}/src/data/* ; do \ + cp -rf $$f $(DESTDIR)$(pkgdatadir)/ ; \ + done +#fonts/ data/pixmaps/ data/sounds/ data/themes/ diff --git a/test/Makefile.am b/test/Makefile.am index 42504e6..e216e02 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -10,7 +10,7 @@ AUTOMAKE_OPTIONS = subdir-objects parallel-tests -Wall -Werror TESTS = debug.build default_flags_to_configure.build rpm.build simple.build \ deb.build -XFAIL_TESTS = deb.build +XFAIL_TESTS = deb.build rpm.build TEST_EXTENSIONS = .build BUILD_LOG_COMPILER = $(SHELL) $(abs_top_srcdir)/test/build_script $(abs_top_srcdir) $(abs_top_builddir) From bfd2f28c706add012c69be5affb9472f441eac01 Mon Sep 17 00:00:00 2001 From: psychomantys Date: Sun, 25 Aug 2013 12:27:49 -0300 Subject: [PATCH 10/21] Change header name. The header generate by build system is called config.h, by the way, a renamed config.h to load_config.h --- configure.ac | 2 +- src/Makefile.am | 2 +- src/bg.c | 2 +- src/category.c | 2 +- src/category.h | 2 +- src/emulator.h | 2 +- src/event.c | 2 +- src/event.h | 2 +- src/font.c | 2 +- src/game.c | 2 +- src/game.h | 2 +- src/game_sel.c | 2 +- src/hint.c | 2 +- src/{config.c => load_config.c} | 2 +- src/{config.h => load_config.h} | 0 src/location.c | 2 +- src/lookup.c | 2 +- src/main.c | 2 +- src/ogl.c | 2 +- src/platform.c | 2 +- src/platform.h | 2 +- src/sdl_ogl.c | 2 +- src/sdl_wrapper.c | 2 +- src/setup.c | 2 +- src/snap.c | 2 +- src/sound.c | 2 +- src/video.c | 2 +- 27 files changed, 26 insertions(+), 26 deletions(-) rename src/{config.c => load_config.c} (99%) rename src/{config.h => load_config.h} (100%) diff --git a/configure.ac b/configure.ac index 60f5651..6ef10d0 100644 --- a/configure.ac +++ b/configure.ac @@ -173,7 +173,7 @@ AC_CONFIG_FILES([ ]) # src/config.hpp -AC_CONFIG_HEADERS([src/envs.h]) +AC_CONFIG_HEADERS([src/config.h]) AC_OUTPUT diff --git a/src/Makefile.am b/src/Makefile.am index 0de2643..0c8107f 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -29,7 +29,7 @@ cabrio_@PACKAGE_VERSION_API@_LDADD = $(libxml2_LIBS) $(SDL_LIBS) \ ## and the variable name derived from that. ## Note that it is not necessary to list header files ## which are already listed elsewhere in a _HEADERS variable assignment. -cabrio_@PACKAGE_VERSION_API@_SOURCES = bg.c config.c emulator.c focus.c \ +cabrio_@PACKAGE_VERSION_API@_SOURCES = bg.c load_config.c emulator.c focus.c \ frame.c game_sel.c key.c lookup.c media.c ogl.c platform.c sdl_wrapper.c \ snap.c submenu.c category.c control.c event.c font.c game.c hint.c \ location.c menu.c packet.c sdl_ogl.c setup.c sound.c video.c main.c diff --git a/src/bg.c b/src/bg.c index f3bc5ce..7854804 100644 --- a/src/bg.c +++ b/src/bg.c @@ -1,5 +1,5 @@ #include "bg.h" -#include "config.h" +#include "load_config.h" #include "sdl_ogl.h" #include "location.h" diff --git a/src/category.c b/src/category.c index 2daca20..d957327 100644 --- a/src/category.c +++ b/src/category.c @@ -1,5 +1,5 @@ #include "category.h" -#include "config.h" +#include "load_config.h" #include "lookup.h" #include diff --git a/src/category.h b/src/category.h index 718e677..0320fe0 100644 --- a/src/category.h +++ b/src/category.h @@ -3,7 +3,7 @@ #include #include -#include "config.h" +#include "load_config.h" struct category_value { struct category_value *next; diff --git a/src/emulator.h b/src/emulator.h index e209776..3f40293 100644 --- a/src/emulator.h +++ b/src/emulator.h @@ -2,7 +2,7 @@ #define _EMULATOR_H_ 1 #include "game.h" -#include "config.h" +#include "load_config.h" int emulator_run( struct game *game ); struct config_emulator *emulator_get_by_name( const char *name ); diff --git a/src/event.c b/src/event.c index a6ceba1..59d53c1 100644 --- a/src/event.c +++ b/src/event.c @@ -1,5 +1,5 @@ #include "control.h" -#include "config.h" +#include "load_config.h" #include "event.h" #include "menu.h" #include "submenu.h" diff --git a/src/event.h b/src/event.h index f61c79d..27269f0 100644 --- a/src/event.h +++ b/src/event.h @@ -1,7 +1,7 @@ #ifndef _EVENT_H_ #define _EVENT_H_ 1 -#include "config.h" +#include "load_config.h" enum event_t { EVENT_NONE, diff --git a/src/font.c b/src/font.c index 00ca157..9d6efc3 100644 --- a/src/font.c +++ b/src/font.c @@ -1,6 +1,6 @@ #include #include -#include "config.h" +#include "load_config.h" #include "font.h" #include "sdl_ogl.h" diff --git a/src/game.c b/src/game.c index 9fc0ee5..2df7223 100644 --- a/src/game.c +++ b/src/game.c @@ -1,6 +1,6 @@ #include #include "game.h" -#include "config.h" +#include "load_config.h" #include "category.h" #include "platform.h" #include "ogl.h" diff --git a/src/game.h b/src/game.h index a87734e..ffd99f4 100644 --- a/src/game.h +++ b/src/game.h @@ -3,7 +3,7 @@ #include "ogl.h" #include "platform.h" -#include "config.h" +#include "load_config.h" struct game_category { struct game_category *next; diff --git a/src/game_sel.c b/src/game_sel.c index 755b339..928b17b 100644 --- a/src/game_sel.c +++ b/src/game_sel.c @@ -4,7 +4,7 @@ #include #include "game_sel.h" #include "bg.h" -#include "config.h" +#include "load_config.h" #include "focus.h" #include "sound.h" #include "emulator.h" diff --git a/src/hint.c b/src/hint.c index 096b9c3..4ee9d33 100644 --- a/src/hint.c +++ b/src/hint.c @@ -1,6 +1,6 @@ #include "hint.h" #include "font.h" -#include "config.h" +#include "load_config.h" #include "sdl_ogl.h" #include "focus.h" #include "location.h" diff --git a/src/config.c b/src/load_config.c similarity index 99% rename from src/config.c rename to src/load_config.c index d354b25..d74e3f2 100644 --- a/src/config.c +++ b/src/load_config.c @@ -10,7 +10,7 @@ #include #include #include -#include "config.h" +#include "load_config.h" #include "key.h" #include "event.h" #include "control.h" diff --git a/src/config.h b/src/load_config.h similarity index 100% rename from src/config.h rename to src/load_config.h diff --git a/src/location.c b/src/location.c index b406d90..e52c163 100644 --- a/src/location.c +++ b/src/location.c @@ -6,7 +6,7 @@ #include #include #include "location.h" -#include "config.h" +#include "load_config.h" struct location_type *type_start = NULL; diff --git a/src/lookup.c b/src/lookup.c index 48c9e57..fe08d30 100644 --- a/src/lookup.c +++ b/src/lookup.c @@ -1,7 +1,7 @@ #include #include "category.h" #include "lookup.h" -#include "config.h" +#include "load_config.h" int lookup_match( const char *pattern, const char *value ) { if( !(pattern && value) ) diff --git a/src/main.c b/src/main.c index bd646ef..ccfcf13 100644 --- a/src/main.c +++ b/src/main.c @@ -2,7 +2,7 @@ #include "sdl_wrapper.h" #include "ogl.h" #include "font.h" -#include "config.h" +#include "load_config.h" #include "category.h" #include "platform.h" #include "bg.h" diff --git a/src/ogl.c b/src/ogl.c index 8d29abe..755b109 100644 --- a/src/ogl.c +++ b/src/ogl.c @@ -1,6 +1,6 @@ #include #include "ogl.h" -#include "config.h" +#include "load_config.h" static int width = 0; static int height = 0; diff --git a/src/platform.c b/src/platform.c index d81b77a..de1a660 100644 --- a/src/platform.c +++ b/src/platform.c @@ -1,5 +1,5 @@ #include "platform.h" -#include "config.h" +#include "load_config.h" #include "location.h" #include "media.h" #include "sdl_ogl.h" diff --git a/src/platform.h b/src/platform.h index c7de314..6228e54 100644 --- a/src/platform.h +++ b/src/platform.h @@ -3,7 +3,7 @@ #include #include -#include "config.h" +#include "load_config.h" #include "ogl.h" struct platform { diff --git a/src/sdl_ogl.c b/src/sdl_ogl.c index 9a86831..1ee1915 100644 --- a/src/sdl_ogl.c +++ b/src/sdl_ogl.c @@ -2,7 +2,7 @@ #include #include #include "sdl_ogl.h" -#include "config.h" +#include "load_config.h" unsigned int next_power_of_two( unsigned int x ) { int i = 0; diff --git a/src/sdl_wrapper.c b/src/sdl_wrapper.c index 30be155..9320bed 100644 --- a/src/sdl_wrapper.c +++ b/src/sdl_wrapper.c @@ -1,5 +1,5 @@ #include -#include "config.h" +#include "load_config.h" #include "sdl_wrapper.h" #include diff --git a/src/setup.c b/src/setup.c index bbf0ea9..659e099 100644 --- a/src/setup.c +++ b/src/setup.c @@ -1,6 +1,6 @@ #include #include "setup.h" -#include "config.h" +#include "load_config.h" #include "event.h" #include "font.h" #include "sdl_ogl.h" diff --git a/src/snap.c b/src/snap.c index dcfdd24..bf063ee 100644 --- a/src/snap.c +++ b/src/snap.c @@ -1,7 +1,7 @@ #include "envs.h" #include "snap.h" #include "game.h" -#include "config.h" +#include "load_config.h" #include "ogl.h" #include "sdl_ogl.h" #include "media.h" diff --git a/src/sound.c b/src/sound.c index a38a3fc..4efd808 100644 --- a/src/sound.c +++ b/src/sound.c @@ -1,5 +1,5 @@ #include "sound.h" -#include "config.h" +#include "load_config.h" #include static const int AUDIO_CHUNK_SIZE = 4096; diff --git a/src/video.c b/src/video.c index beb6176..e25e526 100644 --- a/src/video.c +++ b/src/video.c @@ -15,7 +15,7 @@ #include "sound.h" #include "packet.h" #include "frame.h" -#include "config.h" +#include "load_config.h" #include "ogl.h" #define AUDIO_BUFFER_SIZE ((AVCODEC_MAX_AUDIO_FRAME_SIZE * 3) / 2) From 0b85fb1f42408a13f0d5608a9bbaabc4f72c15ff Mon Sep 17 00:00:00 2001 From: psychomantys Date: Sun, 25 Aug 2013 13:13:19 -0300 Subject: [PATCH 11/21] Change install method doc. --- README.md | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 259c49f..29f35ae 100644 --- a/README.md +++ b/README.md @@ -5,10 +5,10 @@ Cabrio is an emulator front-end primarily designed for use with arcade cabinets. It features a simple graphical interface which is easy to use with limited controls (e.g. a joystick). - Installation ------------ You will need the following libraries and their headers/development packages: + * SDL * SDL_image * SDL_gfx @@ -18,12 +18,30 @@ You will need the following libraries and their headers/development packages: * libxml2 * ffmpeg -Compile the program by running 'make' in this directory. Install by running -'make install' (this will usually have to be done as root, but the location -can be edited in the Makefile). +To configure, compile and install the program run: +```ShellScript +./configure --prefix=/usr +make -j 3 +make install +``` -See http://www.cabrio-fe.org/support/compile.html for more information. +To make a **.rpm** package: + +```ShellScript +./configure --prefix=/usr +make -j 3 +make pkg-rpm +``` +To make a **.deb** package: + +```ShellScript +./configure --prefix=/usr +make -j 3 +make pkg-deb +``` + +See http://www.cabrio-fe.org/support/compile.html for more information. Configuration ------------- @@ -46,3 +64,4 @@ Astronomy, Heidelberg). http://hubblesite.org/ Default font "FreeSans.ttf" courtesy of the GNU FreeFont project: http://www.gnu.org/software/freefont/ + From 96a537b7f387e967fcc269b4bdcea0e022833311 Mon Sep 17 00:00:00 2001 From: psychomantys Date: Sun, 25 Aug 2013 13:14:58 -0300 Subject: [PATCH 12/21] Autotools generate makefile for windows. No more need. --- Makefile.mingw | 22 ---------------------- 1 file changed, 22 deletions(-) delete mode 100644 Makefile.mingw diff --git a/Makefile.mingw b/Makefile.mingw deleted file mode 100644 index 311f4bd..0000000 --- a/Makefile.mingw +++ /dev/null @@ -1,22 +0,0 @@ -CC=gcc -DATA_DIR=data -CFLAGS=-g -Wall -DDATA_DIR=\"$(DATA_DIR)\" -LDFLAGS=SDL.dll libSDL_gfx-13.dll SDL_image.dll SDL_mixer.dll SDL_ttf.dll \ - libfreetype-6.dll glut.dll iconv.dll libxml2.dll libpng12-0.dll jpeg.dll \ - libvorbis-0.dll libvorbisfile-3.dll mikmod.dll smpeg.dll \ - avcodec-52.dll avdevice-52.dll avformat-52.dll avutil-49.dll swscale-0.dll \ - -lglu32 -lopengl32 -mwindows - -INCLUDES=-I./include -I/usr/include/libxml2 - -cabrio: main.o ogl.o sdl_wrapper.o config.o bg.o menu.o game_sel.o \ - game.o font.o hint.o platform.o submenu.o \ - sound.o event.o key.o control.o setup.o sdl_ogl.o video.o packet.o frame.o \ - category.o focus.o emulator.o snap.o media.o location.o lookup.o - $(CC) -o $@ $^ $(LDFLAGS) - -.c.o: %.c - $(CC) $(CFLAGS) $(INCLUDES) -o $@ -c $< - -clean: - rm -f cabrio *.o core From 7fa1b141330a44f8c557a39ecb8ce9d66a6525c7 Mon Sep 17 00:00:00 2001 From: psychomantys Date: Sun, 25 Aug 2013 23:54:36 -0300 Subject: [PATCH 13/21] Change version numbers to latest release --- configure.ac | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/configure.ac b/configure.ac index 6ef10d0..86b38fe 100644 --- a/configure.ac +++ b/configure.ac @@ -1,7 +1,7 @@ # Process this file with autoconf to produce a configure script. #AC_PREREQ([2.80]) -AC_INIT(cabrio, 01.00, https://groups.google.com/group/cabrio-fe-dev/) +AC_INIT(cabrio, 0.8.1, https://groups.google.com/group/cabrio-fe-dev/) AC_CONFIG_MACRO_DIR([build-aux/m4]) AC_CONFIG_AUX_DIR([build-aux]) @@ -26,12 +26,8 @@ AC_SUBST([PACKAGE_REQUIRED_BUILD], ["libavcodec-dev libavutil-dev libavformat-de AC_SUBST([PACKAGE_REQUIRED_RUNTIME], ["libavcodec libavutil libavformat libglut3 libsdl1.2 libsdl-image1.2 libsdl-gfx1.2 libsdl-mixer1.2 libsdl-ttf2.0 libswscale libxml2 zlib1g"] ) AC_SUBST([PACKAGE_VERSION_MAJOR], [0]) -AC_SUBST([PACKAGE_VERSION_MINOR], [1]) -AC_SUBST([PACKAGE_VERSION_MINOR_FIX], [0]) - -AC_SUBST([PACKAGE_VERSION_SO], [${PACKAGE_VERSION_MAJOR}:${PACKAGE_VERSION_MINOR}:${PACKAGE_VERSION_MINOR_FIX}]) -AC_SUBST([PACKAGE_VERSION_API], [${PACKAGE_VERSION_MAJOR}.${PACKAGE_VERSION_MINOR}]) - +AC_SUBST([PACKAGE_VERSION_MINOR], [8]) +AC_SUBST([PACKAGE_VERSION_MINOR_FIX], [1]) # Checks for programs. AC_PROG_CXX @@ -152,8 +148,6 @@ AS_IF([ test "x$pkgsrvdir" = "x" -o "x$pkgsrvdir" = "xNONE" -o "x$pkgsrvdir" = " AC_SUBST( pkgsrvdir, ["$(eval eval echo $localstatedir)/${PACKAGE_NAME}-${PACKAGE_VERSION_MAJOR}"]) ]) - - # Add required deps for linker # Add required deps for compiler # Add source code include dir for make. The builddir is add here for de case From 5df5f9161d5d7a541f7fd4d953cda6365e5a6097 Mon Sep 17 00:00:00 2001 From: psychomantys Date: Mon, 26 Aug 2013 00:31:27 -0300 Subject: [PATCH 14/21] Change old header "envs.h" to "config.h" --- configure.ac | 8 +++++--- src/load_config.c | 2 +- src/snap.c | 46 +++++++++++++++++++++++----------------------- src/snap.h | 24 ++++++++++++------------ 4 files changed, 41 insertions(+), 39 deletions(-) diff --git a/configure.ac b/configure.ac index 86b38fe..f4b6d4c 100644 --- a/configure.ac +++ b/configure.ac @@ -1,10 +1,9 @@ # Process this file with autoconf to produce a configure script. -#AC_PREREQ([2.80]) AC_INIT(cabrio, 0.8.1, https://groups.google.com/group/cabrio-fe-dev/) -AC_CONFIG_MACRO_DIR([build-aux/m4]) AC_CONFIG_AUX_DIR([build-aux]) +AC_CONFIG_MACRO_DIR([build-aux/m4]) AM_INIT_AUTOMAKE([foreign subdir-objects parallel-tests color-tests silent-rules -Wall -Werror]) @@ -20,7 +19,7 @@ AC_SUBST([PACKAGE_DESCRIPTION_LONG], ["Cabrio is a graphical front end for emula AC_SUBST([PACKAGE_URL], ["http://www.cabrio-fe.org/"] ) AC_SUBST([PACKAGE_AUTHOR], ["Steve Maddison"] ) -AC_SUBST([PACKAGE_AUTHOR_EMAIL], ["..."] ) +AC_SUBST([PACKAGE_AUTHOR_EMAIL], ["steve@cosam.org"] ) AC_SUBST([PACKAGE_REQUIRED_BUILD], ["libavcodec-dev libavutil-dev libavformat-dev libglut3-dev libsdl1.2-dev libsdl-image1.2-dev libsdl-gfx1.2-dev libsdl-mixer1.2-dev libsdl-ttf2.0-dev libswscale-dev libxml2-dev zlib1g-dev"] ) AC_SUBST([PACKAGE_REQUIRED_RUNTIME], ["libavcodec libavutil libavformat libglut3 libsdl1.2 libsdl-image1.2 libsdl-gfx1.2 libsdl-mixer1.2 libsdl-ttf2.0 libswscale libxml2 zlib1g"] ) @@ -29,6 +28,9 @@ AC_SUBST([PACKAGE_VERSION_MAJOR], [0]) AC_SUBST([PACKAGE_VERSION_MINOR], [8]) AC_SUBST([PACKAGE_VERSION_MINOR_FIX], [1]) +AC_SUBST([PACKAGE_VERSION_API], [${PACKAGE_VERSION_MAJOR}.${PACKAGE_VERSION_MINOR}]) + + # Checks for programs. AC_PROG_CXX AC_PROG_CPP diff --git a/src/load_config.c b/src/load_config.c index d74e3f2..4dad260 100644 --- a/src/load_config.c +++ b/src/load_config.c @@ -15,7 +15,7 @@ #include "event.h" #include "control.h" #include "sound.h" -#include "envs.h" +#include "config.h" #include #include diff --git a/src/snap.c b/src/snap.c index bf063ee..3e19445 100644 --- a/src/snap.c +++ b/src/snap.c @@ -1,8 +1,8 @@ -#include "envs.h" +#include "config.h" #include "snap.h" -#include "game.h" -#include "load_config.h" -#include "ogl.h" +#include "game.h" +#include "load_config.h" +#include "ogl.h" #include "sdl_ogl.h" #include "media.h" #include "video.h" @@ -12,34 +12,34 @@ static const GLfloat MAX_SIZE = 280; static const GLfloat SCALE_FACTOR = 0.012; static const GLfloat PLATFORM_SIZE = 0.8; static struct texture *texture = NULL; -static struct texture *platform_texture = NULL; -#define NUM_NOISE 3 -static struct texture *noise[NUM_NOISE]; -static int frame = 0; -static int noise_skip = 10; -static const int MAX_STEPS = 50; -static int steps = 50; -static int step = 0; -static int hide_direction = 0; +static struct texture *platform_texture = NULL; +#define NUM_NOISE 3 +static struct texture *noise[NUM_NOISE]; +static int frame = 0; +static int noise_skip = 10; +static const int MAX_STEPS = 50; +static int steps = 50; +static int step = 0; +static int hide_direction = 0; static int visible = 0; static GLfloat scale = 0.006; -static GLfloat platform_scale = 1; +static GLfloat platform_scale = 1; static GLfloat hidden_offset = -4.0; static int video = 0; static int width, height; - + int snap_init( void ) { const struct config *config = config_get(); - int i; - noise[0] = sdl_create_texture( PACKAGE_DATA_DIR "/pixmaps/noise1.png" ); - noise[1] = sdl_create_texture( PACKAGE_DATA_DIR "/pixmaps/noise2.png" ); - noise[2] = sdl_create_texture( PACKAGE_DATA_DIR "/pixmaps/noise3.png" ); - - if( noise[0] == NULL || noise[1] == NULL || noise[2] == NULL ) { + int i; + noise[0] = sdl_create_texture( PACKAGE_DATA_DIR "/pixmaps/noise1.png" ); + noise[1] = sdl_create_texture( PACKAGE_DATA_DIR "/pixmaps/noise2.png" ); + noise[2] = sdl_create_texture( PACKAGE_DATA_DIR "/pixmaps/noise3.png" ); + + if( noise[0] == NULL || noise[1] == NULL || noise[2] == NULL ) { fprintf( stderr, "Warning: Couldn't create texture for snap noise\n" ); - return -1; - } + return -1; + } for( i = 0 ; i < NUM_NOISE ; i++ ) { noise[i]->width = MAX_SIZE; diff --git a/src/snap.h b/src/snap.h index 3cd6eea..bb56acb 100644 --- a/src/snap.h +++ b/src/snap.h @@ -1,16 +1,16 @@ -#ifndef _SNAP_H_ -#define _SNAP_H_ +#ifndef _SNAP_H_ +#define _SNAP_H_ #include "game.h" - -int snap_init( void ); -void snap_free( void ); + +int snap_init( void ); +void snap_free( void ); void snap_pause( void ); -int snap_resume( void ); -void snap_show( void ); +int snap_resume( void ); +void snap_show( void ); void snap_hide( void ); -void snap_draw( void ); -int snap_set( struct game *game ); -void snap_clear( void ); - -#endif +void snap_draw( void ); +int snap_set( struct game *game ); +void snap_clear( void ); + +#endif From c813c11dbb6ac3fa1eeb1180afd93c036b530d3e Mon Sep 17 00:00:00 2001 From: psychomantys Date: Mon, 26 Aug 2013 00:32:15 -0300 Subject: [PATCH 15/21] Add a .gitignore file. --- .gitignore | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4d2233c --- /dev/null +++ b/.gitignore @@ -0,0 +1,49 @@ +# Compiled Object files +*.slo +*.lo +*.o + +# Compiled Dynamic libraries +*.so + +# Compiled Static libraries +*.lai +*.la +*.a + +# Compiled Bins. +a.out + +# Latex +*.log +*.aux +*.nav +*.out +*.snm +*.toc + +# Backup files +*~ +.*.sw* +.backups +.backup + +# svn +.svn + +# autotools +*.in +Makefile +*.m4 +*.cache/ +build-aux/depcomp +build-aux/install-sh +build-aux/missing +stamp-h1 +cabrio.spec +config.status +configure +packages/debian/control +src/.deps/ +src/config.h + From 0974d9d0c32d18d6382445be1601fe9d9a1b4d84 Mon Sep 17 00:00:00 2001 From: psychomantys Date: Mon, 26 Aug 2013 02:50:54 -0300 Subject: [PATCH 16/21] Add headers to configure. --- configure.ac | 3 +-- src/Makefile.am | 5 +++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index f4b6d4c..ed944aa 100644 --- a/configure.ac +++ b/configure.ac @@ -166,8 +166,7 @@ AC_CONFIG_FILES([ Makefile src/Makefile test/Makefile packages/debian/control cabrio.spec - ]) -# src/config.hpp +]) AC_CONFIG_HEADERS([src/config.h]) diff --git a/src/Makefile.am b/src/Makefile.am index 0c8107f..c41af3a 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -34,6 +34,11 @@ cabrio_@PACKAGE_VERSION_API@_SOURCES = bg.c load_config.c emulator.c focus.c \ snap.c submenu.c category.c control.c event.c font.c game.c hint.c \ location.c menu.c packet.c sdl_ogl.c setup.c sound.c video.c main.c +noinst_HEADERS = bg.h load_config.h emulator.h focus.h \ + frame.h game_sel.h key.h lookup.h media.h ogl.h platform.h sdl_wrapper.h \ + snap.h submenu.h category.h control.h event.h font.h game.h hint.h \ + location.h menu.h packet.h sdl_ogl.h setup.h sound.h video.h + install-data-local: $(mkinstalldirs) $(DESTDIR)$(pkgdatadir)/ @for f in ${abs_top_srcdir}/src/data/* ; do \ From 64c18d7d441d2e03267df2e9e2960e5f2c25d7ee Mon Sep 17 00:00:00 2001 From: psychomantys Date: Mon, 26 Aug 2013 16:18:24 -0300 Subject: [PATCH 17/21] libavdevice not used. --- configure.ac | 1 - src/Makefile.am | 7 ++----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/configure.ac b/configure.ac index ed944aa..d084c7f 100644 --- a/configure.ac +++ b/configure.ac @@ -50,7 +50,6 @@ PKG_CHECK_MODULES(libavformat, libavformat) PKG_CHECK_MODULES(libavutil, libavutil) PKG_CHECK_MODULES(libavcodec, libavcodec) PKG_CHECK_MODULES(libswscale, libswscale) -PKG_CHECK_MODULES(libavdevice, libavdevice) # openGL PKG_CHECK_MODULES(GL, gl) PKG_CHECK_MODULES(GLU, glu) diff --git a/src/Makefile.am b/src/Makefile.am index c41af3a..2be7563 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -9,20 +9,17 @@ AUTOMAKE_OPTIONS=subdir-objects -Wall -Werror # The name of program appended the version string. bin_PROGRAMS = cabrio-@PACKAGE_VERSION_API@ - - cabrio_@PACKAGE_VERSION_API@_CFLAGS = $(libxml2_CFLAGS) $(SDL_CFLAGS) \ $(SDL_ttf_CFLAGS) $(SDL_gfx_CFLAGS) $(SDL_image_CFLAGS) \ - $(SDL_mixer_CFLAGS) $(libavdevice_CFLAGS) $(libavformat_CFLAGS) \ + $(SDL_mixer_CFLAGS) $(libavformat_CFLAGS) \ $(libavutil_CFLAGS) $(libavcodec_CFLAGS) $(GL_CFLAGS) $(GLU_CFLAGS) \ $(libswscale_CFLAGS) cabrio_@PACKAGE_VERSION_API@_LDADD = $(libxml2_LIBS) $(SDL_LIBS) \ - $(libavdevice_LIBS) $(SDL_ttf_LIBS) $(SDL_gfx_LIBS) $(SDL_image_LIBS) \ + $(SDL_ttf_LIBS) $(SDL_gfx_LIBS) $(SDL_image_LIBS) \ $(SDL_mixer_LIBS) $(libavformat_LIBS) $(libavutil_LIBS) \ $(libavcodec_LIBS) $(libswscale_LIBS) $(GL_LIBS) $(GLU_LIBS) - ## Define the source file list for the "@PACKAGE_NAME@-@PACKAGE_VERSION_API@" ## target. Note that @PACKAGE_VERSION_API@ is not interpreted by Automake and ## will therefore be treated as if it were literally part of the target name, From 04c533e83419b532f5ecbe1c4742dec38840e289 Mon Sep 17 00:00:00 2001 From: psychomantys Date: Mon, 26 Aug 2013 17:00:36 -0300 Subject: [PATCH 18/21] Fix "pkg-deb" package creation rule for make. --- Makefile.am | 5 +++-- packages/debian/control.in | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Makefile.am b/Makefile.am index 7f739f0..6a19262 100644 --- a/Makefile.am +++ b/Makefile.am @@ -31,10 +31,11 @@ pkg-deb: make DESTDIR=$(TEMP_PKG_DEB_DIR) install cp packages/debian/control $(TEMP_PKG_DEB_DIR)/DEBIAN/control - echo -n 'Depends: ' >> $(TEMP_PKG_DEB_DIR)/DEBIAN/control +# echo -n 'Depends: ' >> $(TEMP_PKG_DEB_DIR)/DEBIAN/control find $(TEMP_PKG_DEB_DIR) -not -type d | xargs -n1 objdump -p 2>/dev/null \ | grep 'NEEDED ' |tr -s ' ' |cut -f 3 -d ' ' | \ - xargs -n1 dpkg -S |cut -f1 -d: |sort -u | xargs echo | tr ' ' ',' >> $(TEMP_PKG_DEB_DIR)/DEBIAN/control + xargs -n1 dpkg -S |cut -f1 -d: |sort -u | xargs echo 'Depends:' | tr ' ' ',' >> $(TEMP_PKG_DEB_DIR)/DEBIAN/control + echo >> $(TEMP_PKG_DEB_DIR)/DEBIAN/control dpkg --build $(TEMP_PKG_DEB_DIR) $(TEMP_PKG_DEB_DIR)/../$(PACKAGE_NAME)-$(PACKAGE_VERSION_API).deb - rm -r $(TEMP_PKG_DEB_DIR) diff --git a/packages/debian/control.in b/packages/debian/control.in index 41c3388..4be812e 100644 --- a/packages/debian/control.in +++ b/packages/debian/control.in @@ -5,6 +5,6 @@ Maintainer: @PACKAGE_AUTHOR@ <@PACKAGE_AUTHOR_EMAIL@> Version: @PACKAGE_VERSION_API@ Package: @PACKAGE_NAME@ Architecture: any -Depends: @PACKAGE_REQUIRED_RUNTIME@ +#Depends: @PACKAGE_REQUIRED_RUNTIME@ Description: @PACKAGE_DESCRIPTION_SHORT@ -@PACKAGE_DESCRIPTION_LONG@ + @PACKAGE_DESCRIPTION_LONG@ From 3eb9e1de34e9ce8f5f29673bc5bb654d99accd1b Mon Sep 17 00:00:00 2001 From: root Date: Mon, 26 Aug 2013 14:51:32 -0300 Subject: [PATCH 19/21] Fix bug on deps building a .deb package on debian --- Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index 6a19262..e31f1aa 100644 --- a/Makefile.am +++ b/Makefile.am @@ -34,7 +34,7 @@ pkg-deb: # echo -n 'Depends: ' >> $(TEMP_PKG_DEB_DIR)/DEBIAN/control find $(TEMP_PKG_DEB_DIR) -not -type d | xargs -n1 objdump -p 2>/dev/null \ | grep 'NEEDED ' |tr -s ' ' |cut -f 3 -d ' ' | \ - xargs -n1 dpkg -S |cut -f1 -d: |sort -u | xargs echo 'Depends:' | tr ' ' ',' >> $(TEMP_PKG_DEB_DIR)/DEBIAN/control + xargs -n1 dpkg -S |cut -f1 -d: | sed 's|^\$|d' | sort -u | xargs echo 'Depends:' | tr ' ' ',' >> $(TEMP_PKG_DEB_DIR)/DEBIAN/control echo >> $(TEMP_PKG_DEB_DIR)/DEBIAN/control dpkg --build $(TEMP_PKG_DEB_DIR) $(TEMP_PKG_DEB_DIR)/../$(PACKAGE_NAME)-$(PACKAGE_VERSION_API).deb - rm -r $(TEMP_PKG_DEB_DIR) From 7463b6a727f30f14bbdd84f11431530446798404 Mon Sep 17 00:00:00 2001 From: root Date: Mon, 26 Aug 2013 16:55:29 -0300 Subject: [PATCH 20/21] Fix bug on of deps, on debian machine. --- Makefile.am | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile.am b/Makefile.am index e31f1aa..ce42a8f 100644 --- a/Makefile.am +++ b/Makefile.am @@ -31,10 +31,10 @@ pkg-deb: make DESTDIR=$(TEMP_PKG_DEB_DIR) install cp packages/debian/control $(TEMP_PKG_DEB_DIR)/DEBIAN/control -# echo -n 'Depends: ' >> $(TEMP_PKG_DEB_DIR)/DEBIAN/control + echo -n 'Depends: ' >> $(TEMP_PKG_DEB_DIR)/DEBIAN/control find $(TEMP_PKG_DEB_DIR) -not -type d | xargs -n1 objdump -p 2>/dev/null \ | grep 'NEEDED ' |tr -s ' ' |cut -f 3 -d ' ' | \ - xargs -n1 dpkg -S |cut -f1 -d: | sed 's|^\$|d' | sort -u | xargs echo 'Depends:' | tr ' ' ',' >> $(TEMP_PKG_DEB_DIR)/DEBIAN/control + xargs -n1 dpkg -S |cut -f1 -d: | sort -u | sed '/^$$/d' | sed '/^ /d' | xargs echo | tr ' ' ',' >> $(TEMP_PKG_DEB_DIR)/DEBIAN/control echo >> $(TEMP_PKG_DEB_DIR)/DEBIAN/control dpkg --build $(TEMP_PKG_DEB_DIR) $(TEMP_PKG_DEB_DIR)/../$(PACKAGE_NAME)-$(PACKAGE_VERSION_API).deb - rm -r $(TEMP_PKG_DEB_DIR) From 7eeb1577eb6b71b23e051e72ff9ec3c95619a1ba Mon Sep 17 00:00:00 2001 From: psychomantys Date: Thu, 6 Feb 2014 16:23:07 -0300 Subject: [PATCH 21/21] Small changes to work ffmpeg-2 --- src/video.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/video.c b/src/video.c index e25e526..01ff624 100644 --- a/src/video.c +++ b/src/video.c @@ -18,7 +18,8 @@ #include "load_config.h" #include "ogl.h" -#define AUDIO_BUFFER_SIZE ((AVCODEC_MAX_AUDIO_FRAME_SIZE * 3) / 2) +#define MAX_AUDIO_FRAME_SIZE 192000 +#define AUDIO_BUFFER_SIZE ((MAX_AUDIO_FRAME_SIZE * 3) / 2) static const int VIDEO_SIZE = 256; static const int CONV_FORMAT = PIX_FMT_RGB24; static const int VIDEO_BPP = 3; @@ -349,7 +350,7 @@ int video_open( const char *filename ) { return -1; } - if( avcodec_open( video_codec_context, video_codec ) != 0 ) { + if( avcodec_open2( video_codec_context, video_codec, NULL ) != 0 ) { fprintf( stderr, "Warning: Couldn't open video codec '%s' for '%s'\n", video_codec->name, filename ); return -1; } @@ -372,7 +373,7 @@ int video_open( const char *filename ) { audio_codec_context = NULL; } else { - if( avcodec_open( audio_codec_context, audio_codec ) != 0 ) { + if( avcodec_open2( audio_codec_context, audio_codec, NULL ) != 0 ) { fprintf( stderr, "Warning: Couldn't open audio codec '%s' for '%s'\n", audio_codec->name, filename ); audio_codec_context = NULL; }