Skip to content

Commit

Permalink
2011-06-25 Pace Willisson <[email protected]>
Browse files Browse the repository at this point in the history
	* V267
	* created fortify_workaround.[ch] to quiet 100+ new compiler
	warnings from the new FORTIFY_SORUCE feature now enabled by
	default in ubuntu
	* added put-data script which figures out if the data files are
	in the development configuration (siblings to the source
	directory) or in the distribution tar file configuration (children
	of the source directory).  Then, it installs them in in DATA_DIR
	* updated DEVELOPER notes for compiling on linux
  • Loading branch information
pace committed Jun 25, 2011
1 parent c4ad344 commit 7713859
Show file tree
Hide file tree
Showing 9 changed files with 187 additions and 25 deletions.
2 changes: 2 additions & 0 deletions Buzz_inc.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ typedef int32_t i32;
#include <math.h>
#include <sys/stat.h>

#include "fortify_workaround.h"

// EMS Includes
// #include <sv_lib.h>

Expand Down
17 changes: 16 additions & 1 deletion ChangeLog
Original file line number Diff line number Diff line change
@@ -1,4 +1,19 @@
2011-06-22 Pace Willisson [email protected]>
2011-06-25 Pace Willisson <[email protected]>

* V267

* created fortify_workaround.[ch] to quiet 100+ new compiler
warnings from the new FORTIFY_SORUCE feature now enabled by
default in ubuntu

* added put-data script which figures out if the data files are
in the development configuration (siblings to the source
directory) or in the distribution tar file configuration (children
of the source directory). Then, it installs them in in DATA_DIR

* updated DEVELOPER notes for compiling on linux

2011-06-22 Pace Willisson <[email protected]>

* add gamedata files to make install-data

Expand Down
33 changes: 20 additions & 13 deletions DEVELOPER
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,33 @@
libvorbis
libtheora all available at http://xiph.org/downloads/

1. Building on Linux - easy
1. Building on Linux

Notes: This requires autoconf, you may need to install this too.
Install the dependencies:

1) Use your favorite package manager to get development libraries, ie:
# apt-get install libsdl-dev libtheora-dev libogg-dev libvorbis-dev
2) $ ./configure
3) $ make
# apt-get install autoconf libsdl-dev libtheora-dev libogg-dev libvorbis-dev

Notes: I needed to do these extra things before ./configure:
If you're working from the tar file, autoconf is already set up for you,
and the data files are in place. Just do:

# cp m4/theora.m4 /usr/share/aclocal/.
$ aclocal -I m4
$ autoconf
$ ./configure
$ make
# make install

autoconf prints one error:
If you want to build from the source repository, check out the cvs
modules race and gamedat and the git repository avdata so they are
siblings to one another.

configure.in:51: error: possibly undefined macro: AC_TYPE_SSIZE_T
Then do:

which can be ignored
$ cd race
$ aclocal -I m4
$ autoconf
$ ./configure
$ make
# make install

See the file os_linux/README for building a .deb

2. Cross compiling: Linux - Windows: tested

Expand Down
12 changes: 2 additions & 10 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ BARIS_OBJS = $(addsuffix .@OBJEXT@, \
endianness futbub future hardef intel intro main mc2 mc mis_c mis_m museum \
newmis news news_sup news_suq place port prefs prest radar randomize rdplex records \
replay review rush start vab pace gx gr sdl music_vorbis gamedata mmfile options fs \
utils logging log4c log_default \
utils logging log4c log_default fortify_workaround \
)

.PHONY: clean doc extendeddoc
Expand All @@ -76,15 +76,7 @@ install: $(PROG_NAME)
install -c -m 755 $(PROG_NAME) ${bindir}
gzip < $(PROG_NAME).6 > ${mandir}/man6/$(PROG_NAME).6.gz
install -c -m 644 README ${docdir}/.

# the file avdata-files comes from the sourceforge
# git repository called "avdata" within the raceintospace project
.PHONY: install-data
install-data:
mkdir -p $(DATA_DIR)
tar -cf - `cat avdata-files` | (cd $(DATA_DIR); tar -xf -)
tar -cf - `cat gamedata/gamedata-files` | (cd $(DATA_DIR); tar -xf -)
find $(DATA_DIR) -type f -print | xargs chmod a-x
./put-data $(DATA_DIR)

# don't change the source of these copies ... they copy
# data from the compilation environment into the build root
Expand Down
2 changes: 2 additions & 0 deletions TODO
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ Improvements that might change rules and/or gameplay balance.

\todo * [5] Factor video display code out from mis_c.c and replay.c

\todo * [5] Fix need for fortify_workaround.h (check fread returns everywhere)

\section other OTHER IDEAS

\todo * Release checklist: valgrind, electric fence, CFLAGS=-O2 -DNDEBUG
Expand Down
14 changes: 14 additions & 0 deletions fortify_workaround.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#include <stdio.h>
#include "fortify_workaround.h"

#if _FORTIFY_SOURCE > 0

#undef fread
size_t
fread_fortify_workaround (void *buf,
size_t size, size_t n, FILE *stream)
{
return (fread (buf, size, n, stream));
}

#endif /* _FORTIFY_SOURCE */
21 changes: 21 additions & 0 deletions fortify_workaround.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#ifndef _FORTIFY_WORKAROUND_
#define _FORTIFY_WORKAROUND_

/*
* there are over 100 places that call fread without checking the
* return value, and they all make warnings with the new
* _FORTIFY_SOURCE feature in gcc. Until someone wants to put error
* handlers in each place, this workaround will preserve the existing
* runtime behavor (that is, hope for the best), at the negligible
* cost of one extra function call per fread, while cleaning up the
* compiler output so we can notice the real warnings
*/
#if _FORTIFY_SOURCE > 0
#define fread fread_fortify_workaround
#endif

size_t fread_fortify_workaround (void *buf,
size_t size, size_t n, FILE *stream);

#endif /* _FORTIFY_WORKAROUND_ */

109 changes: 109 additions & 0 deletions put-data
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
#! /bin/sh

# development directory configuration:
#
# DEVDIR/race/*.c, *.h, etc
# DEVDIR/gamedat/gamedata-files
# DEVDIR/avdata/avdata-files
# DEVDIR/avdata/audio/
# DEVDIR/avdata/video/
#
# when everything is packaged in one tar, and then used to build
# the .deb file, the directory configuration is
#
# raceintospace-1.0/*.c, *.h, etc
# raceintospace-1.0/gamedata-files
# raceintospace-1.0/gamedata/
# raceintospace-1.0/avdata-files
# raceintospace-1.0/audio/
# raceintospace-1.0/video/
#
# this script tracks down the gamedata and avdata locations, and copies
# the files to the runtime location (/usr/local/share/raceintospace)

if [ $# != 1 ]
then
echo "usage: put-data DATA_DIR"
exit 1
fi

DATA_DIR=$1

mkdir -p ${DATA_DIR}

# ================================================================
# install gamedata
# careful: the source repository is "gamedat", but most uses are "gamedata"

if [ -r gamedata/gamedata-files ]
then
echo "installing gamedata from working directory"
gamedata_dir=.
elif [ -r ../gamedat/gamedata-files ]
then
echo "installing gamedata from ../gamedata"
gamedata_dir=../gamedat
else
echo "put-data: can't find gamedata directory"
echo ""
echo "if you're trying to do development, you probably want"
echo "something like this:"
echo ""

cdir=`pwd`
pdir=`dirname $cdir`
echo "\$ cd $pdir"
echo "\$ cvs checkout -d:ext:raceintospace.cvs.sourceforge.net:/cvsroot/raceintospace co gamedat"
echo ""
echo "which will make the gamedat module a sibling"
echo "to the main source directory"
exit 1
fi

(
cd ${gamedata_dir}
mkdir -p ${DATA_DIR}/gamedata
cp --parents `cat gamedata-files` ${DATA_DIR}/gamedata
sed "s:^:${DATA_DIR}/gamedata/:" < gamedata-files | xargs chmod a=r,u+w
)

# ================================================================
# install avdata

if [ -r avdata-files ]
then
echo "installing avdata files from working directory"
avdata_dir=.
elif [ -r ../avdata/avdata-files ]
then
echo "installing avdata files from ../avdata"
avdata_dir=../avdata
else
echo "put-data: can't find avdata directory"
echo ""
echo "if you're trying to do development, you probably want"
echo "something like this:"
echo ""

cdir=`pwd`
pdir=`dirname $cdir`
echo "\$ cd $pdir"
echo "\$ git clone ssh://raceintospace.git.sourceforge.net/gitroot/raceintospace/avdata"
echo ""
echo "which will make the avdata module a sibling"
echo "to the main source directory"

exit 1
fi

(
cd ${avdata_dir}
cp --parents `cat avdata-files` ${DATA_DIR}
sed "s:^:${DATA_DIR}/:" < avdata-files | xargs chmod a=r,u+w
)

echo "done"




2 changes: 1 addition & 1 deletion version.c
Original file line number Diff line number Diff line change
@@ -1 +1 @@
266
267

0 comments on commit 7713859

Please sign in to comment.