Page 1 of 1

git repository now contains everthing to "make run"

Posted: Mon Mar 02, 2015 11:09 pm
by Holger
Even though some might consider this being "bad", I've added a bunch of binary data to the git repository: classic graphics, sounds and music and the four classic level sets (and the element description texts, which are of course in text format).

Besides that, the build system now takes care of building the required graphics files in PNG format from the "source" image files in ILBM format. (Yes, I mainly use DeluxePaint for editing the R'n'D graphics, although I just switched to GrafX2, which is a great DPaint replacement).

You can now clone a fresh copy of the R'n'D git repository and type "make run" -- that should be all to get you going with the latest stuff. So no need anymore to add stuff from the latest release package until the error messages disappear. :-)

"make clean-git" should remove everything that was dynamically generated (while "make clean" does not remove the dynamically generated source files and PNG graphics, which would not be desired for normal development).

One last hint: Make sure to install Perl and the NetPBM tools before building.

Re: git repository now contains everthing to "make run"

Posted: Tue Mar 03, 2015 8:12 am
by filbo
I have to `make sdl` to override the default SDL2 choice. (Actually `make sdl RO_GAME_DIR=/usr/share/games/rocksndiamonds RW_GAME_DIR=/var/games/rocksndiamonds`, not wanting to maintain local edits to the makefile...)

`make run` fails with a bunch of "sdl2-config: Command not found"

`make sdl` eventually fails with:

...
ilbmtoppm RocksToons.ilbm | pnmtopng > RocksToons.png
ilbmtoppm: unknown chunk type DPPS - skipping
ilbmtoppm: input is a 6-plane EHB ILBM
pnmtopng: 34 colors found
../../rocksndiamonds -e "create CE image RocksCE.bmp"
Segmentation fault (core dumped)
make[3]: *** [RocksCE.ilbm] Error 139

Debug:

filbo@kidlap1:/usr/share/games/rocksndiamonds/downloads/src/rocksndiamonds-git/rocksndiamonds$ gdb ./rocksndiamonds
GNU gdb (Ubuntu/Linaro 7.4-2012.04-0ubuntu2.1) 7.4-2012.04
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
For bug reporting instructions, please see:
<http://bugs.launchpad.net/gdb-linaro/>...
Reading symbols from /usr/share/games/rocksndiamonds/downloads/src/rocksndiamonds-git/rocksndiamonds/rocksndiamonds...done.
(gdb) run -e "create CE image RocksCE.bmp"
Starting program: /usr/share/games/rocksndiamonds/downloads/src/rocksndiamonds-git/rocksndiamonds/rocksndiamonds -e "create CE image RocksCE.bmp"
warning: no loadable sections found in added symbol-file system-supplied DSO at 0x7ffff7ffa000
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault.
__strchr_sse2 () at ../sysdeps/x86_64/multiarch/../strchr.S:33
33 ../sysdeps/x86_64/multiarch/../strchr.S: No such file or directory.
(gdb) where
#0 __strchr_sse2 () at ../sysdeps/x86_64/multiarch/../strchr.S:33
#1 0x00007ffff6e3cc68 in putenv (string=0x0) at putenv.c:56
#2 0x00000000004b9800 in SDLInitVideoDisplay () at sdl.c:257
#3 0x0000000000493451 in CreateCustomElementImages (filename=0x7fffffffe8ff "RocksCE.bmp") at files.c:9785
#4 0x000000000040bf91 in Execute_Command (command=0x7fffffffe8ef "create CE image RocksCE.bmp") at init.c:4739
#5 0x000000000040dea2 in OpenAll () at init.c:5677
#6 0x0000000000403641 in main (argc=3, argv=0x7fffffffe598) at main.c:5639

filbo@kidlap1:/usr/share/games/rocksndiamonds/downloads/src/rocksndiamonds-git/rocksndiamonds$ ltrace -o lol ./rocksndiamonds -e "create CE image RocksCE.bmp"
filbo@kidlap1:/usr/share/games/rocksndiamonds/downloads/src/rocksndiamonds-git/rocksndiamonds$ tail -5 lol
strncmp("create CE image RocksCE.bmp", "create images ", 14) = -38
strncmp("create CE image RocksCE.bmp", "create CE image ", 16) = 0
putenv(NULL <unfinished ...>
--- SIGSEGV (Segmentation fault) ---
+++ killed by SIGSEGV +++

Re: git repository now contains everthing to "make run"

Posted: Tue Mar 03, 2015 10:23 am
by Holger
Sorry, I haven't tested this with SDL 1.2, where it ran into an error indeed. (The problem was that setup values were used that haven't been initialized at that stage.)

It's fixed and successfully tested with SDL 1.2 now.

Re: git repository now contains everthing to "make run"

Posted: Tue Mar 03, 2015 11:48 am
by filbo
Getting closer :)

$ make sdl RO_GAME_DIR=/usr/share/games/rocksndiamonds RW_GAME_DIR=/var/games/rocksndiamonds
...
ilbmtoppm RocksToons.ilbm | pnmtopng > RocksToons.png
ilbmtoppm: unknown chunk type DPPS - skipping
ilbmtoppm: input is a 6-plane EHB ILBM
pnmtopng: 34 colors found
../../rocksndiamonds -e "create CE image RocksCE.bmp"
rocksndiamonds: fatal error: LoadCustomImage(): cannot find file 'RocksCE-template.ilbm'
rocksndiamonds: aborting
make[3]: *** [RocksCE.ilbm] Error 1
$ strace -o lol ./rocksndiamonds -e "create CE image RocksCE.bmp"
rocksndiamonds: fatal error: LoadCustomImage(): cannot find file 'RocksCE-template.ilbm'
rocksndiamonds: aborting
$ grep CE-t lol | uniq
access("/usr/share/games/rocksndiamonds/levels/graphics/RocksCE-template.ilbm", F_OK) = -1 ENOENT (No such file or directory)
access("/usr/share/games/rocksndiamonds/graphics/gfx_classic/RocksCE-template.ilbm", F_OK) = -1 ENOENT (No such file or directory)
access("/usr/share/games/rocksndiamonds/graphics/RocksCE-template.ilbm", F_OK) = -1 ENOENT (No such file or directory)

It's rummaging in $RO_GAME_DIR for a file that (I think) is only intended to live in the build tree.

This fixed it:

$ sudo cp -p graphics/gfx_classic/RocksCE-template.ilbm /usr/share/games/rocksndiamonds/graphics/

... but breaks the 'everything to "make run"' concept :)

Re: git repository now contains everthing to "make run"

Posted: Tue Mar 03, 2015 12:00 pm
by filbo
`make run` assumes sdl2; turns out this can be overridden, I now use:

$ make run DEFAULT_TARGET=sdl RO_GAME_DIR=/usr/share/games/rocksndiamonds RW_GAME_DIR=/var/games/rocksndiamonds

but basically "run" and the other makefile targets that invoke "all", e.g. "gdb", "leveltest" etc. are "convenience" targets which are really only convenient for your dev target.

Maybe: before doing much, check for existence of `sdl2-config` command; if not found, bail out with a message like:

You must specify a target by running:

make DEFAULT_TARGET=name [args this make was run with]

BUT, this doesn't really work because the other targets like "mac" etc. don't work by setting only DEFAULT_TARGET.

Re: git repository now contains everthing to "make run"

Posted: Tue Mar 03, 2015 12:26 pm
by Holger
Hm, yes, right: The problem is indeed that running the compiled R'n'D within the build process causes it to look for build-only files in install-target directories, which does not work well, of course. So apparently there was a reason that I used a hard-coded path before. I should give this part a bit more polish to have it work for values of RO_GAME_DIR and RW_GAME_DIR other than "." ...

Regarding build targets in the Makefile, you're right that a lot of them are internal targets that only work for me when cross-compiling, testing, packaging etc.; they won't work out of the box on other systems. Maybe I should add some more comments to make this more clear.

Regarding targets "sdl2" vs. "sdl", yes, this would be something for a "configure" script... Maybe I can add some code that checks for "sdl2-config", as you suggested, and automatically falls back to target "sdl", if it is not found.

Re: git repository now contains everthing to "make run"

Posted: Tue Mar 03, 2015 7:50 pm
by Holger
OK, I've fixed now using the configured (compiled) R'n'D data directory for reading the template file for "RocksCE.ilbm" and instead use the directory specified by that command line option (which replaces the output file option; this makes sense, as both values are highly related anyway).

Then, I've added your suggestion for auto-detecting the SDL target (by checking for sdl2-config and sdl-config scripts).

So there is no "DEFAULT_TARGET" anymore, but it is auto-detected when building now. (Using "make sdl" or "make sdl2" or using "TARGET=sdl" etc. still works for explicitly using a certain SDL version, which is especially useful if you have installed both.)

Re: git repository now contains everthing to "make run"

Posted: Wed Mar 04, 2015 5:17 am
by filbo
OK!

$ git pull; make clean-git; make run RO_GAME_DIR=/usr/share/games/rocksndiamonds RW_GAME_DIR=/var/games/rocksndiamonds

... RnD pops up! With visible mouse cursor (when I move it) in the splash screen!

Re: git repository now contains everthing to "make run"

Posted: Wed Mar 04, 2015 8:17 am
by Holger
I'm happy that it works out of the box now!

Thanks a lot for your help improving the build system!

Re: git repository now contains everthing to "make run"

Posted: Thu Jan 07, 2016 12:30 pm
by filbo
Hi, you recently removed the top-level README file with a log claiming it was "outdated".

Now, there are certainly parts of it which are out of date, possibly no longer useful or at least needing changes to be currently relevant. But other parts still look useful. I think in particular the sections on Setup and The Tape Recorder aren't much covered anywhere else.

Re: git repository now contains everthing to "make run"

Posted: Thu Jan 07, 2016 12:43 pm
by Holger
Hmm, maybe you're right.

My thoughts on the "README" file were that it would need a complete rewrite on the one hand, but on the other hand, quite some parts of it (like the description of the main menu) seemed to be unneeded, and then, nobody reads manuals (and "README" files) anyway... ;-)

But with a look at the sections covering the setup menu and tape recorder, I think you're right than some further explanations could indeed be useful.

I think I'll review and rewrite that file again. Thanks for pointing this out.

Re: git repository now contains everthing to "make run"

Posted: Fri Jan 08, 2016 10:52 am
by filbo
This brings to mind that you never commented on config recommendation: tape player buttons & actions (which is related to this); nor copy level file, save, overwrites wrong level (which isn't)... :)

Re: git repository now contains everthing to "make run"

Posted: Tue Jan 19, 2016 11:53 pm
by Holger
Thanks for bumping these two posts again -- I've read them, but simply forgot to write an answer. :-o