aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Game/Code/Makefile.in62
-rw-r--r--Game/Code/configure.ac137
-rw-r--r--Game/Code/m4/fpc.m428
3 files changed, 170 insertions, 57 deletions
diff --git a/Game/Code/Makefile.in b/Game/Code/Makefile.in
index 6ab1902e..defada7a 100644
--- a/Game/Code/Makefile.in
+++ b/Game/Code/Makefile.in
@@ -14,19 +14,20 @@ top_srcdir = @top_srcdir@
datarootdir = @datarootdir@
VPATH = @srcdir@
+usdxrootdir = ../..
+
# install tool
INSTALL = @INSTALL@
# calls "ln -s"
LN_S = @LN_S@
USDX_PREFIX = UltraStar
-USDX_TOOLS_DIR = ../../Tools
+USDX_TOOLS_DIR = $(usdxrootdir)/Tools
EXE_SUFFIX = @EXEEXT@
# Free Pascal compiler
PPC = @PPC@
-PFLAGS = @PFLAGS@
PLIBS = @PLIBS@
# FPC target platform and processor
PPLATFORM = @FPC_PLATFORM@
@@ -63,29 +64,33 @@ PINC_FLAGS = $(PINC_TOKEN)lib/JEDI-SDL/SDL/Pas
# Defines
PDEFINES = -dLCL
+# this is necessary to use lazjpeg instead of Ulazjpeg
+# but requires configure to detect if gtk/gkt2 or qt is used
#-dLCL$(LCL_WIDGET_TYPE)
-# Misc fpc options
-PCOMPAT_FLAGS = -S2dgi
-#PCOMPAT_FLAGS += -Mdelphi
-PVERBOSE_FLAGS = -vew -l
-#PDEBUG_FLAGS = -g -gl
-#PDEBUG_FLAGS = -dDEBUG
-#POTHER_FLAGS = -Crtoi
-#POPTIMIZE_FLAGS_FPC204 = -OG2p3
-#POPTIMIZE_FLAGS_FPC220 = -O2p"NAME"
-#POPTIMIZE_FLAGS = -dRELEASE
-#POPTIMIZE_FLAGS = -Xs
-PFLAGS += $(PCOMPAT_FLAGS) \
- $(PVERBOSE_FLAGS) \
- $(PDEFINES)
+# FPC flags
+
+# The user can overwrite the default flags with
+# make PFLAGS="myflags"
+PFLAGS = -S2dgi
+# the user's flags (specified with configure) must be the last in
+# the list to overwrite the defaults (e.g.with the - option: -Xs-).
+PFLAGS += @PFLAGS@
+
+PFLAGS_DEBUG = @PFLAGS_DEBUG@
+PFLAGS_RELEASE = @PFLAGS_RELEASE@
+
+# The user can specify additional flags with
+# make PFLAGS_EXTRA="myflags"
+PFLAGS_EXTRA =
+PFLAGS += $(PFLAGS_EXTRA)
# lpr project file used as input
USDX_SRC = $(USDX_PREFIX)$(PROJ_SUFFIX)
# name of executable
-USDX_BIN = $(USDX_PREFIX)$(EXE_SUFFIX)
+USDX_BIN = $(usdxrootdir)/$(USDX_PREFIX)$(EXE_SUFFIX)
-.PHONY: all resources ultrastardx-app install install-dev install-release uninstall uninstall-dev uninstall-release clean distclean clean_obj clean_res
+.PHONY: all resources ultrastardx-app install install-dev install-release uninstall uninstall-dev uninstall-release clean distclean clean_obj clean_res fetch-sounds
all: resources ultrastardx-app
@@ -100,7 +105,7 @@ ultrastardx-app: $(USDX_BIN)
$(USDX_BIN): clean_obj
# $(MAKE) clean_obj
mkdir -p $(PCUNIT_DIR)
- $(PPC) $(PFLAGS) $(PLIBS) $(PINC_FLAGS) $(PUNIT_FLAGS) $(PCUNIT_FLAGS) -o$@ $(USDX_SRC)
+ $(PPC) $(PFLAGS) $(PDEFINES) $(PLIBS) $(PINC_FLAGS) $(PUNIT_FLAGS) $(PCUNIT_FLAGS) -o$@ $(USDX_SRC)
install: install-@install_type@
# all
@@ -111,10 +116,25 @@ uninstall: uninstall-@install_type@
# local development build
install-dev:
- mv $(USDX_BIN) ../..
+ @if [ ! -d "$(usdxrootdir)/Visuals" ]; then \
+ echo "Copying visualizer data to $(usdxrootdir)/Visuals ..."; \
+ cp -r "$(usdxrootdir)/InstallerDependencies/Visuals" "$(usdxrootdir)"; \
+ fi
+ @if [ ! -f "$(usdxrootdir)/Sounds/Common start.mp3" ]; then \
+ echo ""; \
+ echo "# The sound-files from Sound-directory of the 1.0.1-branch are required."; \
+ echo "# Copy them yourself to \"$(usdxrootdir)/Sounds\""; \
+ echo "# or if you are connected to the web try:"; \
+ echo "# make fetch-sounds"; \
+ fi
+
+fetch-sounds:
+ svn co https://ultrastardx.svn.sourceforge.net/svnroot/ultrastardx/branches/1.0.1/Sounds tmp-sounds
+ mv tmp-sounds/*.mp3 $(usdxrootdir)/Sounds
+ rm -rf tmp-sounds
uninstall-dev:
- rm -f ../../$(USDX_BIN)
+ rm -f $(USDX_BIN)
# global release build
diff --git a/Game/Code/configure.ac b/Game/Code/configure.ac
index 9ca6e46a..781e2bd9 100644
--- a/Game/Code/configure.ac
+++ b/Game/Code/configure.ac
@@ -1,10 +1,9 @@
#
-# UltraStar-DX configure.in script
+# UltraStar-DX configure.ac script
#
# by UltraStar Deluxe Team
#
-# Call "aclocal -I m4" to create the aclocal.m4 file.
-# Process this file with autoconf to produce a configure script.
+# Execute "autogen.sh" to create the configure script.
#
# Require autoconf >= 2.61
@@ -29,7 +28,7 @@ AC_CONFIG_MACRO_DIR(m4)
# show features and packages in one list
AC_PRESERVE_HELP_ORDER
-#echo $LIBS
+#echo $LDFLAGS
#define([maco], [])
#echo maco
@@ -59,10 +58,11 @@ if [[ x$with_lazarus = xno ]] ; then
fi
# add lazarus widget-type option
-AC_ARG_WITH([lcl_widget_type],
+# the result is not used at the moment
+AC_ARG_WITH([lcl-widget-type],
[AS_HELP_STRING([--with-lcl-widget-type=TYPE],
- [Lazarus LCL Widget Type @<:@default=gtk2@:>@])],
- [with_lcl_widget_type=$withval], [with_lcl_widget_type="gtk2"])
+ [Lazarus LCL Widget Type @<:@default=check@:>@])],
+ [with_lcl_widget_type=$withval], [with_lcl_widget_type=""])
if [[ x$with_lcl_widget_type = xno -o x$with_lcl_widget_type = xyes ]] ; then
AC_MSG_ERROR([Invalid LCL Widget Type (try one of gtk2/gtk/qt)]);
fi
@@ -85,6 +85,12 @@ AC_ARG_WITH([projectM],
[Enable projectM visualization support @<:@default=check@:>@])],
[with_projectM=$withval], [with_projectM="check"])
+# add skip pkg-config error option
+AC_ARG_ENABLE([skip-pkgconfig-errors],
+ [AS_HELP_STRING([--enable-skip-pkgconfig-errors],
+ [Continue if pkg-config does not find a package @<:@default=no@:>@])],
+ [skip_pkgconfig_errors=$withval], [skip_pkgconfig_errors="no"])
+
# print path options header
AC_ARG_WITH([cfg-dummy2], [
Additional directories:])
@@ -109,7 +115,7 @@ AC_ARG_WITH([cfg-dummy3], [
Development options:])
# add dev_layout option
-AC_ARG_ENABLE(dev_build,
+AC_ARG_ENABLE(dev-build,
[AS_HELP_STRING([--enable-dev-build],
[local development build])],
[enable_dev_build="yes"], [enable_dev_build="no"])
@@ -144,27 +150,40 @@ AC_PROG_GREP
# AC_SUBST([$VARIABLE_PREFIX]_VERSION_type] for each type
AC_DEFUN([AC_SPLIT_VERSION],
[
+ version=[$2]
+
+ # strip leading non-numeric tokens
+ # (necessary for some ffmpeg-packages in ubuntu)
+ # example: 0d.51.1.0 -> 51.1.0
+ version=`echo $version | $SED 's/^[[^.]]*[[^0-9.]][[^.]]*\.//'`
+
# replace "." and "-" with " " and ignore trailing tokens.
# 1.23.4-r2 will be splitted to [maj=1, min=23, rel=4].
# In addition we delete every character which is not 0-9.
# 1.3a4-r32 will be [maj=1, min=34, rel=32].
- #
- # Note: We use a here-document (<<< here-strings not POSIX compatible)
- # Do NOT indent the eof-delimiter
read major minor release ignore <<eof
- `echo [$2] | tr '.-' ' ' | $SED 's/[[^0-9\ ]].*//'`
+ `echo $version | tr '.-' ' ' | $SED 's/[[^0-9\ ]].*//'`
eof
+ # Note: Do NOT indent the eof-delimiter
+ # We use a here-document (<<< here-strings not POSIX compatible)
# strip preceding 0s and set unset version-parts to 0
[$1][_VERSION_MAJOR]=$(($major))
[$1][_VERSION_MINOR]=$(($minor))
[$1][_VERSION_RELEASE]=$(($release))
+ # integer representation: MMMmmmrrr (M:major,m:minor,r:release)
+ # can be used if pkg-config's comparison fails
+ [$1][_VERSION_INT]=$(($[$1][_VERSION_MAJOR]*1000000+$[$1][_VERSION_MINOR]*1000+$[$1][_VERSION_RELEASE]))
AC_SUBST([$1][_VERSION_MAJOR])
AC_SUBST([$1][_VERSION_MINOR])
AC_SUBST([$1][_VERSION_RELEASE])
+ AC_SUBST([$1][_VERSION_INT])
])
+# set to yes if a pkg-config error was skipped
+pkgconfig_error_skipped="no"
+
# AC_PKG_CHECK_VERSION(VARIABLE_PREFIX, MODULE, REQUIRED, PATH, MIN, MAX)
# Aborts if lib was not found and REQUIRED="yes".
# The PATH can be "check", "no" or "yes"
@@ -176,7 +195,7 @@ eof
# [$VARIABLE_PREFIX]_VERSION_RELEASE
AC_DEFUN([AC_PKG_CHECK_VERSION],
[
- have_lib=no
+ have_lib="no"
if test x$4 != xno; then
# on empty PATH or PATH="yes"/"check" use the default path
if test x$4 = x -o x$4 = xyes -o x$4 = xcheck; then
@@ -208,7 +227,7 @@ AC_DEFUN([AC_PKG_CHECK_VERSION],
AC_MSG_CHECKING(for [$2]$minmax_text)
[$1][_VERSION]=`eval $lib_path $PKG_CONFIG $minmax_flags --modversion [$2] --silence-errors`
if test $? -eq 0; then
- have_lib=yes
+ have_lib="yes"
[$1][_HAVE]="yes"
AC_SPLIT_VERSION([$1], $[$1][_VERSION])
AC_MSG_RESULT(yes @<:@$[$1][_VERSION]@:>@)
@@ -220,8 +239,33 @@ AC_DEFUN([AC_PKG_CHECK_VERSION],
[$1][_HAVE]="no"
AC_SPLIT_VERSION([$1], [0.0.0])
AC_MSG_RESULT(no)
- if test x$3 = xyes -o x$4 = xyes; then
- AC_MSG_ERROR([Could not find required library $2. Please install $2 and try again.]);
+ if test x$3 = xyes -o x$4 = xyes; then
+ AC_MSG_WARN([
+!!! Could not find the required library $2.
+]);
+ # do not abort if skip-pkgconfig-errors is set
+ if test x$skip_pkgconfig_errors = xno; then
+ AC_MSG_ERROR([
+!!! Please install $2 and try again.
+!!!
+!!! If it is already installed check if "[$2].pc" is present in one
+!!! of the pkg-config search directories (e.g. /usr/lib/pkgconfig).
+!!!
+!!! If the file is present but not in the standard search path you may add
+!!! its directory by prepending "PKG_CONFIG_PATH=mylibs_dir/pkgconfig/" to
+!!! your configure call.
+!!! See the man-page on pkg-config for further information.
+!!!
+!!! Some linux distributions do not provide a .pc-file by the default
+!!! package so you might have to install a special dev-package.
+!!!
+!!! If all of this does not help you may consider to skip this error and
+!!! adjust the configuration file yourself.
+!!! To do this call "./configure --enable-skip-pkgconfig-errors ...".
+])
+ else
+ pkgconfig_error_skipped="yes"
+ fi
fi
fi
])
@@ -255,7 +299,7 @@ if [[ x$PKG_CONFIG = x ]]; then
fi
# -----------------------------------------
-# check for libraries
+# check for lazarus
# -----------------------------------------
# set dirs to check for lazarus
@@ -288,17 +332,42 @@ AC_SPLIT_VERSION([LAZARUS], [$LAZARUS_VERSION])
AC_MSG_RESULT(@<:@$LAZARUS_VERSION@:>@)
# check if LCL Widget type is valid
-LCL_WIDGET_TYPE=$with_lcl_widget_type
-LCL_UNIT_DIR="$LAZARUS_DIR/lcl/units/$FPC_PROCESSOR-$FPC_PLATFORM"
-LCL_WIDGET_DIR="$LCL_UNIT_DIR/$LCL_WIDGET_TYPE"
-AC_MSG_CHECKING([whether LCL Widget Type "$LCL_WIDGET_TYPE" is valid])
-if [[ -d "$LCL_WIDGET_DIR" ]]; then
- AC_MSG_RESULT(yes)
+if [[ x$with_lcl_widget_type = x ]]; then
+ # search for standard types
+ LCL_CHECK_WIDGET_TYPES="gtk2 gtk qt win32 carbon"
else
- AC_MSG_RESULT(no)
-# AC_MSG_ERROR(LCL Widget Type not available: directory "$LCL_WIDGET_DIR" not found.)
+ # search for user defined type only
+ LCL_CHECK_WIDGET_TYPES="$with_lcl_widget_type"
fi
+# LCL widget specific base dir
+LCL_UNIT_DIR="$LAZARUS_DIR/lcl/units/$FPC_PROCESSOR-$FPC_PLATFORM"
+
+# check for a supported widget type
+LCL_WIDGET_TYPE=""
+for widget_type in $LCL_CHECK_WIDGET_TYPES; do
+ widget_dir="$LCL_UNIT_DIR/$widget_type"
+ AC_MSG_CHECKING([whether LCL Widget Type "$widget_type" is supported])
+ if [[ -d "$widget_dir" ]]; then
+ LCL_WIDGET_TYPE=$widget_type
+ AC_MSG_RESULT(yes)
+ break
+ else
+ AC_MSG_RESULT(no)
+ fi
+done
+
+# check if a widget type was found
+if [[ x$LCL_WIDGET_TYPE = x ]]; then
+ AC_MSG_ERROR([
+!!! Could not detect the LCL Widget Type.
+!!! Specify the widget type with the --with-lcl-widget-type option.])
+fi
+
+# -----------------------------------------
+# check for libraries
+# -----------------------------------------
+
# find sdl
AC_PKG_CHECK_VERSION(SDL, [sdl], yes)
@@ -306,6 +375,13 @@ AC_PKG_CHECK_VERSION(SDL, [sdl], yes)
AC_PKG_CHECK_VERSION(SQLITE3, [sqlite3], yes)
# find ffmpeg
+# Note: do not use the min/max version parameters with ffmpeg
+# otherwise it might fail in ubuntu due to a wrong version number
+# format in ffmpeg's .pc-files.
+# For example: 0d.51.1.2 instead of the correct 51.1.2.
+# A check for a version >=52.0.0 will return version 0d.51.1.2
+# although it is lower because pkg-config is confused by the 0d.
+# Use [mylib]_VERSION_INT instead
AC_PKG_CHECK_VERSION(AVCODEC, [libavcodec], yes)
AC_CHECK_LIB(avcodec, avcodec_decode_audio)
AC_CHECK_LIB(avcodec, avcodec_decode_audio2)
@@ -424,3 +500,14 @@ AC_MSG_NOTICE([
#!!! $PACKAGE_BUGREPORT
#!!! You might as well ask for help at the IRC-Channel
#!!! $PACKAGE_IRC
+
+if [[ x$pkgconfig_error_skipped = xyes ]]; then
+ AC_MSG_WARN([
+??? pkg-config did not find all of the required libraries.
+??? Edit "config-linux.inc" to add the missing parts.
+??? If one of your libraries' directories is not in the linker's
+??? search-path add it to the LDFLAGS environment variable and
+??? rerun configure (e.g. ./configure LDFLAGS="-Lmylibdir" ...).
+])
+fi
+
diff --git a/Game/Code/m4/fpc.m4 b/Game/Code/m4/fpc.m4
index 44822b28..51ebfc63 100644
--- a/Game/Code/m4/fpc.m4
+++ b/Game/Code/m4/fpc.m4
@@ -39,30 +39,34 @@ AC_ARG_ENABLE(release,
[Enable FPC release options (same as --enable-debug=no)])],
[FPC_DEBUG="no"], [])
-dnl use -dDEBUG (instead of -g) so it uses the fpc.cfg defaults
+dnl do not use -dDEBUG because this will enable range-checks
+dnl that will fail with USDX.
+dnl we have to disable -Xs which is defined in fpc.cfg.
AC_ARG_WITH(debug-flags,
[AS_HELP_STRING([--with-debug-flags],
- [FPC debug flags @<:@-dDEBUG@:>@])],
- [fpc_debugflags="$withval"],
- [fpc_debugflags="-dDEBUG"])
+ [FPC debug flags @<:@-gl -Coi -Xs- -vew@:>@])],
+ [PFLAGS_DEBUG="$withval"],
+ [PFLAGS_DEBUG="-gl -Cit -Xs- -vew"])
-dnl use -dDEBUG (instead of e.g. -O2) so it uses the fpc.cfg defaults
+dnl -dRELEASE works too but we define our own settings
AC_ARG_WITH(release-flags,
[AS_HELP_STRING([--with-release-flags],
- [FPC release flags @<:@-dRELEASE@:>@])],
- [fpc_releaseflags="$withval"],
- [fpc_releaseflags="-dRELEASE"])
+ [FPC release flags @<:@-O2 -Xs -vew@:>@])],
+ [PFLAGS_RELEASE="$withval"],
+ [PFLAGS_RELEASE="-O2 -Xs -vew"])
+dnl the user's PFLAGS must *follow* this script's flags
+dnl to enable the user to overwrite the settings.
if test x$FPC_DEBUG = xyes; then
- PFLAGS="$PFLAGS $fpc_debugflags"
+ PFLAGS="$PFLAGS_DEBUG $PFLAGS"
else
- PFLAGS="$PFLAGS $fpc_releaseflags"
+ PFLAGS="$PFLAGS_RELEASE $PFLAGS"
fi
AC_ARG_ENABLE(profile,
[AS_HELP_STRING([--enable-profile],
[Enable FPC profiling options])],
- [PFLAGS="$PFLAGS -pg"], [])
+ [PFLAGS="-pg $PFLAGS"], [])
PPC_CHECK_PROGS="fpc FPC ppc386 ppc PPC386 ppos2"
@@ -91,6 +95,8 @@ fi
FPC_BASE_PATH="${FPC_PREFIX}/lib/fpc/${FPC_VERSION}"
FPC_UNIT_PATH="${FPC_BASE_PATH}/units/${FPC_PLATFORM}"
AC_SUBST(PFLAGS)
+AC_SUBST(PFLAGS_DEBUG)
+AC_SUBST(PFLAGS_RELEASE)
AC_SUBST(FPC_VERSION)
AC_SUBST(FPC_PLATFORM)
AC_SUBST(FPC_PROCESSOR)