From c41f8ff07abb09a0a016cb998be69b9b0b5d7569 Mon Sep 17 00:00:00 2001 From: chaoskagami Date: Fri, 6 May 2016 08:06:25 -0400 Subject: [PATCH] Autotoolized the build process (hopefully correctly) --- Makefile.in | 59 +++-- aclocal.m4 | 432 +++++++++++++++++++++++++++++++++++++ autogen.sh | 1 - build | 21 -- buildscripts/build.generic | 26 --- buildscripts/build.mingw32 | 29 --- buildscripts/build.mingw64 | 31 --- buildscripts/deps.generic | 28 --- buildscripts/mk | 70 ------ configure.ac | 26 ++- 10 files changed, 482 insertions(+), 241 deletions(-) create mode 100644 aclocal.m4 delete mode 100755 build delete mode 100755 buildscripts/build.generic delete mode 100755 buildscripts/build.mingw32 delete mode 100755 buildscripts/build.mingw64 delete mode 100755 buildscripts/deps.generic delete mode 100755 buildscripts/mk diff --git a/Makefile.in b/Makefile.in index cd01dab..474eb9c 100644 --- a/Makefile.in +++ b/Makefile.in @@ -3,38 +3,28 @@ top_srcdir = @top_srcdir@ srcdir = @srcdir@ VPATH = @srcdir@ -.SUFFIXES: -.SUFFIXES: .c .o - -OPT=-g -O - -AR = ar -AR_FLAGS = rc -RANLIB = @RANLIB@ - -CC = @CC@ -CFLAGS = -I. @CFLAGS@ -LDFLAGS = @LDFLAGS@ -LIBS = @LIBS@ -INSTALL = @INSTALL@ -prefix = @prefix@ -exec_prefix = @exec_prefix@ -bindir = $(exec_prefix)/bin -libdir = $(prefix)/lib -infodir = $(prefix)/info - -SOURCES=Data.cpp Loop.cpp op_bgload.cpp op_choice.cpp op_cleartext.cpp op_delay.cpp op_fi.cpp op_goto.cpp op_gsetvar.cpp op_if.cpp op_jump.cpp op_music.cpp op_random.cpp op_save.cpp op_setimg.cpp op_setvar.cpp op_sound.cpp op_text.cpp Parse.cpp VNDC.cpp - -OBJS=Data.o Loop.o op_bgload.o op_choice.o op_cleartext.o op_delay.o op_fi.o op_goto.o op_gsetvar.o op_if.o op_jump.o op_music.o op_random.o op_save.o op_setimg.o op_setvar.o op_sound.o op_text.o Parse.o VNDC.o +.SUFFIXES: .c .o .cpp + +PICFLAGS := -fPIC +CXX := @CXX@ +CXXFLAGS := @CXXFLAGS@ $(PICFLAGS) +CPPFLAGS := -I$(srcdir)/include -I$(srcdir)/platform/include +LDFLAGS := $(PICFLAGS) @LDFLAGS@ +LIBS := @LIBS@ +INSTALL := @INSTALL@ +prefix := @prefix@ +exec_prefix := @exec_prefix@ +bindir := $(exec_prefix)/bin +libdir := $(prefix)/lib +infodir := $(prefix)/info + +SOURCES=$(wildcard src/*.cpp platform/src/*.cpp) +OBJS=$(patsubst %.cpp,%.o,$(SOURCES)) MISC=configure mkinstalldirs install-sh aclocal.m4 -# ??? replace with your targets all: vndc -# ??? here I make the bindir, libdir and infodir directories; you -# might not need all of these. also, I assumed the names PROG and -# libMYPROG.a for the program and library. install: all $(top_srcdir)/mkinstalldirs $(bindir) $(top_srcdir)/mkinstalldirs $(libdir) @@ -44,21 +34,22 @@ install: all uninstall: /bin/rm -f $(bindir)/vndc -vndc: $(SOURCES) - $(CXX) $(CXXFLAGS) -o vndc $(OBJS) +%.o: %.cpp + $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c -o $@ $< + +vndc: $(OBJS) + $(CXX) $(CXXFLAGS) $(LDFLAGS) $(LIBS) -o $@ $(OBJS) clean: - /bin/rm -f *.o vndc + /bin/rm -f $(OBJS) vndc distclean: clean /bin/rm -f Makefile config.h config.status config.cache config.log -nuke: distclean +clobber: distclean /bin/rm -fr autom4te.cache configure +# These are for compatibility, nothing more. mostlyclean: clean maintainer-clean: clean - -#PROG.info: PROG.texi -# makeinfo PROG.texi diff --git a/aclocal.m4 b/aclocal.m4 new file mode 100644 index 0000000..9e8dbf2 --- /dev/null +++ b/aclocal.m4 @@ -0,0 +1,432 @@ +# generated automatically by aclocal 1.15 -*- Autoconf -*- + +# Copyright (C) 1996-2014 Free Software Foundation, Inc. + +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) +# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- +# serial 1 (pkg-config-0.24) +# +# Copyright © 2004 Scott James Remnant . +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# PKG_PROG_PKG_CONFIG([MIN-VERSION]) +# ---------------------------------- +AC_DEFUN([PKG_PROG_PKG_CONFIG], +[m4_pattern_forbid([^_?PKG_[A-Z_]+$]) +m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$]) +m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$]) +AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility]) +AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path]) +AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path]) + +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then + AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) +fi +if test -n "$PKG_CONFIG"; then + _pkg_min_version=m4_default([$1], [0.9.0]) + AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + PKG_CONFIG="" + fi +fi[]dnl +])# PKG_PROG_PKG_CONFIG + +# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +# +# Check to see whether a particular set of modules exists. Similar +# to PKG_CHECK_MODULES(), but does not set variables or print errors. +# +# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG]) +# only at the first occurence in configure.ac, so if the first place +# it's called might be skipped (such as if it is within an "if", you +# have to call PKG_CHECK_EXISTS manually +# -------------------------------------------------------------- +AC_DEFUN([PKG_CHECK_EXISTS], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +if test -n "$PKG_CONFIG" && \ + AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then + m4_default([$2], [:]) +m4_ifvaln([$3], [else + $3])dnl +fi]) + +# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) +# --------------------------------------------- +m4_define([_PKG_CONFIG], +[if test -n "$$1"; then + pkg_cv_[]$1="$$1" + elif test -n "$PKG_CONFIG"; then + PKG_CHECK_EXISTS([$3], + [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes ], + [pkg_failed=yes]) + else + pkg_failed=untried +fi[]dnl +])# _PKG_CONFIG + +# _PKG_SHORT_ERRORS_SUPPORTED +# ----------------------------- +AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG]) +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi[]dnl +])# _PKG_SHORT_ERRORS_SUPPORTED + + +# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], +# [ACTION-IF-NOT-FOUND]) +# +# +# Note that if there is a possibility the first call to +# PKG_CHECK_MODULES might not happen, you should be sure to include an +# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac +# +# +# -------------------------------------------------------------- +AC_DEFUN([PKG_CHECK_MODULES], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl +AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl + +pkg_failed=no +AC_MSG_CHECKING([for $1]) + +_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) +_PKG_CONFIG([$1][_LIBS], [libs], [$2]) + +m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS +and $1[]_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details.]) + +if test $pkg_failed = yes; then + AC_MSG_RESULT([no]) + _PKG_SHORT_ERRORS_SUPPORTED + if test $_pkg_short_errors_supported = yes; then + $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1` + else + $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD + + m4_default([$4], [AC_MSG_ERROR( +[Package requirements ($2) were not met: + +$$1_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +_PKG_TEXT])[]dnl + ]) +elif test $pkg_failed = untried; then + AC_MSG_RESULT([no]) + m4_default([$4], [AC_MSG_FAILURE( +[The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +_PKG_TEXT + +To get pkg-config, see .])[]dnl + ]) +else + $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS + $1[]_LIBS=$pkg_cv_[]$1[]_LIBS + AC_MSG_RESULT([yes]) + $3 +fi[]dnl +])# PKG_CHECK_MODULES + + +# PKG_INSTALLDIR(DIRECTORY) +# ------------------------- +# Substitutes the variable pkgconfigdir as the location where a module +# should install pkg-config .pc files. By default the directory is +# $libdir/pkgconfig, but the default can be changed by passing +# DIRECTORY. The user can override through the --with-pkgconfigdir +# parameter. +AC_DEFUN([PKG_INSTALLDIR], +[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])]) +m4_pushdef([pkg_description], + [pkg-config installation directory @<:@]pkg_default[@:>@]) +AC_ARG_WITH([pkgconfigdir], + [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],, + [with_pkgconfigdir=]pkg_default) +AC_SUBST([pkgconfigdir], [$with_pkgconfigdir]) +m4_popdef([pkg_default]) +m4_popdef([pkg_description]) +]) dnl PKG_INSTALLDIR + + +# PKG_NOARCH_INSTALLDIR(DIRECTORY) +# ------------------------- +# Substitutes the variable noarch_pkgconfigdir as the location where a +# module should install arch-independent pkg-config .pc files. By +# default the directory is $datadir/pkgconfig, but the default can be +# changed by passing DIRECTORY. The user can override through the +# --with-noarch-pkgconfigdir parameter. +AC_DEFUN([PKG_NOARCH_INSTALLDIR], +[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])]) +m4_pushdef([pkg_description], + [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@]) +AC_ARG_WITH([noarch-pkgconfigdir], + [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],, + [with_noarch_pkgconfigdir=]pkg_default) +AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir]) +m4_popdef([pkg_default]) +m4_popdef([pkg_description]) +]) dnl PKG_NOARCH_INSTALLDIR + + +# PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE, +# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +# ------------------------------------------- +# Retrieves the value of the pkg-config variable for the given module. +AC_DEFUN([PKG_CHECK_VAR], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl + +_PKG_CONFIG([$1], [variable="][$3]["], [$2]) +AS_VAR_COPY([$1], [pkg_cv_][$1]) + +AS_VAR_IF([$1], [""], [$5], [$4])dnl +])# PKG_CHECK_VAR + +# Configure paths for SDL +# Sam Lantinga 9/21/99 +# stolen from Manish Singh +# stolen back from Frank Belew +# stolen from Manish Singh +# Shamelessly stolen from Owen Taylor + +# serial 1 + +dnl AM_PATH_SDL2([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) +dnl Test for SDL, and define SDL_CFLAGS and SDL_LIBS +dnl +AC_DEFUN([AM_PATH_SDL2], +[dnl +dnl Get the cflags and libraries from the sdl2-config script +dnl +AC_ARG_WITH(sdl-prefix,[ --with-sdl-prefix=PFX Prefix where SDL is installed (optional)], + sdl_prefix="$withval", sdl_prefix="") +AC_ARG_WITH(sdl-exec-prefix,[ --with-sdl-exec-prefix=PFX Exec prefix where SDL is installed (optional)], + sdl_exec_prefix="$withval", sdl_exec_prefix="") +AC_ARG_ENABLE(sdltest, [ --disable-sdltest Do not try to compile and run a test SDL program], + , enable_sdltest=yes) + + min_sdl_version=ifelse([$1], ,2.0.0,$1) + + if test "x$sdl_prefix$sdl_exec_prefix" = x ; then + PKG_CHECK_MODULES([SDL], [sdl2 >= $min_sdl_version], + [sdl_pc=yes], + [sdl_pc=no]) + else + sdl_pc=no + if test x$sdl_exec_prefix != x ; then + sdl_config_args="$sdl_config_args --exec-prefix=$sdl_exec_prefix" + if test x${SDL2_CONFIG+set} != xset ; then + SDL2_CONFIG=$sdl_exec_prefix/bin/sdl2-config + fi + fi + if test x$sdl_prefix != x ; then + sdl_config_args="$sdl_config_args --prefix=$sdl_prefix" + if test x${SDL2_CONFIG+set} != xset ; then + SDL2_CONFIG=$sdl_prefix/bin/sdl2-config + fi + fi + fi + + if test "x$sdl_pc" = xyes ; then + no_sdl="" + SDL2_CONFIG="pkg-config sdl2" + else + as_save_PATH="$PATH" + if test "x$prefix" != xNONE && test "$cross_compiling" != yes; then + PATH="$prefix/bin:$prefix/usr/bin:$PATH" + fi + AC_PATH_PROG(SDL2_CONFIG, sdl2-config, no, [$PATH]) + PATH="$as_save_PATH" + AC_MSG_CHECKING(for SDL - version >= $min_sdl_version) + no_sdl="" + + if test "$SDL2_CONFIG" = "no" ; then + no_sdl=yes + else + SDL_CFLAGS=`$SDL2_CONFIG $sdl_config_args --cflags` + SDL_LIBS=`$SDL2_CONFIG $sdl_config_args --libs` + + sdl_major_version=`$SDL2_CONFIG $sdl_config_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` + sdl_minor_version=`$SDL2_CONFIG $sdl_config_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` + sdl_micro_version=`$SDL2_CONFIG $sdl_config_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` + if test "x$enable_sdltest" = "xyes" ; then + ac_save_CFLAGS="$CFLAGS" + ac_save_CXXFLAGS="$CXXFLAGS" + ac_save_LIBS="$LIBS" + CFLAGS="$CFLAGS $SDL_CFLAGS" + CXXFLAGS="$CXXFLAGS $SDL_CFLAGS" + LIBS="$LIBS $SDL_LIBS" +dnl +dnl Now check if the installed SDL is sufficiently new. (Also sanity +dnl checks the results of sdl2-config to some extent +dnl + rm -f conf.sdltest + AC_TRY_RUN([ +#include +#include +#include +#include "SDL.h" + +char* +my_strdup (char *str) +{ + char *new_str; + + if (str) + { + new_str = (char *)malloc ((strlen (str) + 1) * sizeof(char)); + strcpy (new_str, str); + } + else + new_str = NULL; + + return new_str; +} + +int main (int argc, char *argv[]) +{ + int major, minor, micro; + char *tmp_version; + + /* This hangs on some systems (?) + system ("touch conf.sdltest"); + */ + { FILE *fp = fopen("conf.sdltest", "a"); if ( fp ) fclose(fp); } + + /* HP/UX 9 (%@#!) writes to sscanf strings */ + tmp_version = my_strdup("$min_sdl_version"); + if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { + printf("%s, bad version string\n", "$min_sdl_version"); + exit(1); + } + + if (($sdl_major_version > major) || + (($sdl_major_version == major) && ($sdl_minor_version > minor)) || + (($sdl_major_version == major) && ($sdl_minor_version == minor) && ($sdl_micro_version >= micro))) + { + return 0; + } + else + { + printf("\n*** 'sdl2-config --version' returned %d.%d.%d, but the minimum version\n", $sdl_major_version, $sdl_minor_version, $sdl_micro_version); + printf("*** of SDL required is %d.%d.%d. If sdl2-config is correct, then it is\n", major, minor, micro); + printf("*** best to upgrade to the required version.\n"); + printf("*** If sdl2-config was wrong, set the environment variable SDL2_CONFIG\n"); + printf("*** to point to the correct copy of sdl2-config, and remove the file\n"); + printf("*** config.cache before re-running configure\n"); + return 1; + } +} + +],, no_sdl=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) + CFLAGS="$ac_save_CFLAGS" + CXXFLAGS="$ac_save_CXXFLAGS" + LIBS="$ac_save_LIBS" + fi + fi + if test "x$no_sdl" = x ; then + AC_MSG_RESULT(yes) + else + AC_MSG_RESULT(no) + fi + fi + if test "x$no_sdl" = x ; then + ifelse([$2], , :, [$2]) + else + if test "$SDL2_CONFIG" = "no" ; then + echo "*** The sdl2-config script installed by SDL could not be found" + echo "*** If SDL was installed in PREFIX, make sure PREFIX/bin is in" + echo "*** your path, or set the SDL2_CONFIG environment variable to the" + echo "*** full path to sdl2-config." + else + if test -f conf.sdltest ; then + : + else + echo "*** Could not run SDL test program, checking why..." + CFLAGS="$CFLAGS $SDL_CFLAGS" + CXXFLAGS="$CXXFLAGS $SDL_CFLAGS" + LIBS="$LIBS $SDL_LIBS" + AC_TRY_LINK([ +#include +#include "SDL.h" + +int main(int argc, char *argv[]) +{ return 0; } +#undef main +#define main K_and_R_C_main +], [ return 0; ], + [ echo "*** The test program compiled, but did not run. This usually means" + echo "*** that the run-time linker is not finding SDL or finding the wrong" + echo "*** version of SDL. If it is not finding SDL, you'll need to set your" + echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" + echo "*** to the installed location Also, make sure you have run ldconfig if that" + echo "*** is required on your system" + echo "***" + echo "*** If you have an old version installed, it is best to remove it, although" + echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"], + [ echo "*** The test program failed to compile or link. See the file config.log for the" + echo "*** exact error that occured. This usually means SDL was incorrectly installed" + echo "*** or that you have moved SDL since it was installed. In the latter case, you" + echo "*** may want to edit the sdl2-config script: $SDL2_CONFIG" ]) + CFLAGS="$ac_save_CFLAGS" + CXXFLAGS="$ac_save_CXXFLAGS" + LIBS="$ac_save_LIBS" + fi + fi + SDL_CFLAGS="" + SDL_LIBS="" + ifelse([$3], , :, [$3]) + fi + AC_SUBST(SDL_CFLAGS) + AC_SUBST(SDL_LIBS) + rm -f conf.sdltest +]) + diff --git a/autogen.sh b/autogen.sh index f378f20..298dda1 100755 --- a/autogen.sh +++ b/autogen.sh @@ -1,3 +1,2 @@ #!/bin/bash - autoreconf -f -i diff --git a/build b/build deleted file mode 100755 index b82a60a..0000000 --- a/build +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash - -mkdir -p bin - -if [ "$1" == "mingw32" ]; then - buildscripts/build.mingw32 -elif [ "$1" == "mingw64" ]; then - buildscripts/build.mingw64 -elif [ "$1" == "linux" ]; then - buildscripts/build.generic -elif [ "$1" == "generic" ]; then - buildscripts/build.generic -elif [ "$1" == "clean" ]; then - rm -rf bin - echo "RM bin" -else - echo "Targets: mingw32, mingw64, linux, generic" - echo "linux32 target was removed. Build in a chroot." - echo "Operations: clean" -fi - diff --git a/buildscripts/build.generic b/buildscripts/build.generic deleted file mode 100755 index 6ab687c..0000000 --- a/buildscripts/build.generic +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash - -## -## Use this build script to build on -## a unix system for the current unix -## system. Linux, freebsd, openbsd, etc. -## - -ROOT=`pwd` -SRC=$ROOT/ -LIB=$ROOT/external/lib -BIN=$ROOT/bin - -CXXFLAGS="-g `pkg-config sdl2 --cflags` `pkg-config SDL2_mixer --cflags` `pkg-config SDL2_image --cflags` `pkg-config SDL2_ttf --cflags`" -LDFLAGS="-lSDL2 -lSDL2_mixer -lSDL2_image -lSDL2_ttf -lGL -lGLEW" -INCLUDE="-I$ROOT/external/zero/include -I$ROOT/vndc/include" - -source buildscripts/mk - -gith vndc/include/gitrev.hpp - -newtd - mkmcc external/zero/src - mkmcc vndc/src - mkld vndc.`uname -m` -deltd diff --git a/buildscripts/build.mingw32 b/buildscripts/build.mingw32 deleted file mode 100755 index f34f96b..0000000 --- a/buildscripts/build.mingw32 +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash - -## -## Use this to build a 32bit windows binary. -## At the moment, I haven't quite figured out static -## linking yet. -## - -ROOT=`pwd` -SRC=$ROOT/ -BIN=$ROOT/bin -CXXFLAGS="-I$ROOT/external/Windows/i686-w64-mingw32/include" - -CROSS=i686-w64-mingw32 - -source buildscripts/mk - -LDFLAGS="-L$ROOT/external/Windows/i686-w64-mingw32/lib -lmingw32 -lSDL2main -lSDL2 -lSDL2_mixer -lSDL2_image -lSDL2_ttf -Dmain=SDL_main -Wl,--no-undefined -lm -ldinput8 -ldxguid -ldxerr8 -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lversion -luuid -static-libgcc -static-libstdc++ -mwindows" -INCLUDE="-I$ROOT/external/zero/include -I$ROOT/vndc/include" - -gith vndc/include/gitrev.hpp - -newtd - mkmcc external/zero/src - mkmcc vndc/src - mkld vndc.exe -deltd - -cp external/Windows/i686-w64-mingw32/bin/*.dll bin/ diff --git a/buildscripts/build.mingw64 b/buildscripts/build.mingw64 deleted file mode 100755 index bbd2f6c..0000000 --- a/buildscripts/build.mingw64 +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/bash - -## -## Use this to build a 64bit windows binary. -## At the moment, I haven't quite figured out static -## linking yet. -## - - -ROOT=`pwd` -SRC=$ROOT/ -BIN=$ROOT/bin - -CXXFLAGS="-I$ROOT/external/Windows/x86_64-w64-mingw32/include" - -CROSS=x86_64-w64-mingw32 - -source buildscripts/mk - -LDFLAGS="-L$ROOT/external/Windows/x86_64-w64-mingw32/lib -lmingw32 -lSDL2main -lSDL2 -lSDL2_mixer -lSDL2_image -lSDL2_ttf -Dmain=SDL_main -Wl,--no-undefined -lm -ldinput8 -ldxguid -ldxerr8 -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lversion -luuid -static-libgcc -static-libstdc++" -INCLUDE="-I$ROOT/external/zero/include -I$ROOT/vndc/include" - -gith vndc/include/gitrev.hpp - -newtd - mkmcc external/zero/src - mkmcc vndc/src - mkld vndc.exe -deltd - -cp external/Windows/x86_64-w64-mingw32/bin/*.dll bin/ diff --git a/buildscripts/deps.generic b/buildscripts/deps.generic deleted file mode 100755 index 52b951e..0000000 --- a/buildscripts/deps.generic +++ /dev/null @@ -1,28 +0,0 @@ -source buildscripts/mk - -cd external - - ROOTDIR=`pwd`/out - - newtd - ../SDL2/configure --prefix=$ROOTDIR - make -j4 - make install - deltd - newtd - ../SDL2_image/configure --prefix=$ROOTDIR - make -j4 - make install - deltd - newtd - ../SDL2_mixer/configure --prefix=$ROOTDIR --disable-music-mod-modplug - make -j4 - make install - deltd - newtd - ../SDL2_ttf/configure --prefix=$ROOTDIR - make -j4 - make install - deltd - -cd .. diff --git a/buildscripts/mk b/buildscripts/mk deleted file mode 100755 index 50d03ae..0000000 --- a/buildscripts/mk +++ /dev/null @@ -1,70 +0,0 @@ -#!/bin/bash - -# This is all auxillary functions to simplify the build script. -# I hate makefiles, and cmake so shell scripts work. - -if [ ! -z "${CROSS}" ]; then - CXX="${CROSS}-g++" - LD="${CROSS}-g++" - AR="${CROSS}-ar rcs" -else - CXX="g++" - LD="g++" - AR="ar rcs" -fi - -CXXFLAGS="$CXXFLAGS -std=gnu++11 -Wall -Werror -Wno-error=pointer-arith" -LDFLAGS="$LDFLAGS -lSDL2 -lSDL2_image -lSDL2_mixer -lSDL2_ttf" - -CA_CMD="$CXX $CXXFLAGS $LDFLAGS" - -FILES=$2 - -function mkcc_ { - echo "CXX $2" - $CXX $CXXFLAGS $INCLUDE -c $1 -o $2 -} - -function mkld_ { - echo "LD $2" - $LD $LDFLAGS $CXXFLAGS $1 -o $2 -} - -function mkcc { - mkcc_ $SRC/$1/$2.cpp $2.cpp.o -} - -function mkmcc { - for f in `ls $SRC/$1/*.cpp`; do - mkcc_ $f $(basename $f).o - done -} - -function mkld { - echo "LD $1" - $LD $CXXFLAGS ./*.o $LDFLAGS -o $BIN/$1 -} - -function mkar { - echo "AR $1" - $AR $LIB/$1.a ./*.o -} - -function newtd { - mkdir td - cd td -} - -function deltd { - cd .. - rm -rf td -} - -function gith { - echo "PROP $1" - echo "#ifndef GIT_REV_HDR" > "$ROOT/$1" - echo "#define GIT_REV_HDR" >> "$ROOT/$1" - echo "#define GIT_REV \"$(git rev-parse HEAD)\"" >> "$ROOT/$1" - echo "$2" >> "$ROOT/$1" - echo "#endif" >> "$ROOT/$1" -} diff --git a/configure.ac b/configure.ac index 327b973..302e4ca 100644 --- a/configure.ac +++ b/configure.ac @@ -3,7 +3,7 @@ AC_PREREQ([2.69]) AC_INIT([libbinmod], [0.3], [chaos.kagami@gmail.com], [vndc], [http://github.com/chaoskagami/vndc]) -AC_CONFIG_SRCDIR([VNDC.cpp]) +AC_CONFIG_SRCDIR([LICENSE]) # Checks for programs. AC_PROG_CC @@ -14,5 +14,29 @@ AC_PROG_RANLIB # Checks for typedefs, structures, and compiler characteristics. AC_TYPE_UINT64_T +# Check for SDL2 +SDL_VERSION=2.0.0 +AM_PATH_SDL2([$SDL_VERSION], :, AC_MSG_ERROR([SDL was not found.])) + +# Check for SDL2 mixer +PKG_CHECK_MODULES([SDL2_mixer], [SDL2_mixer >= 2.0.0]) + +# Check for SDL2 image +PKG_CHECK_MODULES([SDL2_image], [SDL2_image >= 2.0.0]) + +# Check for SDL2 ttf +PKG_CHECK_MODULES([SDL2_ttf], [SDL2_ttf >= 2.0.0]) + +# Check for gl +PKG_CHECK_MODULES([gl], [gl > 0]) + +# Check for glew +PKG_CHECK_MODULES([glew], [glew > 0]) + +CXXFLAGS="$CXXFLAGS $SDL_CFLAGS $SDL2_mixer_CFLAGS $SDL2_image_CFLAGS $SDL2_ttf_CFLAGS $gl_CFLAGS $glew_CFLAGS" +LIBS="$LIBS $SDL_LIBS $SDL2_mixer_LIBS $SDL2_image_LIBS $SDL2_ttf_LIBS $gl_LIBS $glew_LIBS" +LDFLAGS="$LDFLAGS $SDL_LDFLAFS $SDL2_mixer_LDFLAGS $SDL2_image_LDFLAGS $SDL2_ttf_LDFLAGS $gl_LDFLAGS $glew_LDFLAGS" + AC_CONFIG_FILES([Makefile]) AC_OUTPUT + -- 2.39.5