Author Topic: Compiling a SDL Game (2023)  (Read 25161 times)

Martin Iturbide

  • OS2World NewsMaster
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 5256
  • Karma: +44/-1
  • Your Friend Wil Declares...
    • View Profile
    • Martin's Personal Blog
Re: Compiling a SDL Game (2023)
« Reply #15 on: August 18, 2023, 03:51:40 pm »
Hi Dave

On RocksnDiamonds and MirrorMagic I was able to hide the console with your indications (the DEF file and even with exehdr).
Now the console don't show, just as I wanted to. But is there a way for the user to see that console if he needs to generate some log.

Regards
Martin Iturbide
OS2World NewsMaster
... just share the dream.

Dave Yeo

  • Hero Member
  • *****
  • Posts: 5365
  • Karma: +127/-1
    • View Profile
Re: Compiling a SDL Game (2023)
« Reply #16 on: August 18, 2023, 04:55:47 pm »
Redirect stdout and stderr to a file. By habit I do "rocksndiamonds 2>&1 | tee rocksndiamonds.log" as I always forget the other way without tee.

Jochen Schäfer

  • Sr. Member
  • ****
  • Posts: 388
  • Karma: +30/-0
    • View Profile
Re: Compiling a SDL Game (2023)
« Reply #17 on: August 18, 2023, 04:56:49 pm »
Redirect stdout and stderr to a file. By habit I do "rocksndiamonds 2>&1 | tee rocksndiamonds.log" as I always forget the other way without tee.
Exactly what I did with FeatherPad.

Martin Iturbide

  • OS2World NewsMaster
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 5256
  • Karma: +44/-1
  • Your Friend Wil Declares...
    • View Profile
    • Martin's Personal Blog
Re: Compiling a SDL Game (2023)
« Reply #18 on: August 21, 2023, 04:08:08 am »
Hi.

I was checking lbreakoutHD, it uses SDL2.
- https://sourceforge.net/projects/lgames/files/lbreakouthd/lbreakouthd-1.1.3.tar.gz

But it has two makefiles, makefile.in and makefile.am, that I don't know how to run. Is there any trick or an specific make tool to see if they can compile?

Regards

Martin Iturbide
OS2World NewsMaster
... just share the dream.

Mentore

  • Full Member
  • ***
  • Posts: 243
  • Karma: +13/-0
    • View Profile
Re: Compiling a SDL Game (2023)
« Reply #19 on: August 21, 2023, 08:17:57 am »
Hi.

I was checking lbreakoutHD, it uses SDL2.
- https://sourceforge.net/projects/lgames/files/lbreakouthd/lbreakouthd-1.1.3.tar.gz

But it has two makefiles, makefile.in and makefile.am, that I don't know how to run. Is there any trick or an specific make tool to see if they can compile?

Regards

Hi Martin,
though I don't remember very well, makefile.in and makefile.am should be a part of the automake package and are needed by the configure shell script.
You may find useful to follow Paul Smedley's rules on compiling Unix ports. It may be as easy as writing "sh configure" or something like this (alas, I don't use an OS/2 machine since ages).

Mentore

Dave Yeo

  • Hero Member
  • *****
  • Posts: 5365
  • Karma: +127/-1
    • View Profile
Re: Compiling a SDL Game (2023)
« Reply #20 on: August 22, 2023, 02:29:11 am »
Hi.

I was checking lbreakoutHD, it uses SDL2.
- https://sourceforge.net/projects/lgames/files/lbreakouthd/lbreakouthd-1.1.3.tar.gz

But it has two makefiles, makefile.in and makefile.am, that I don't know how to run. Is there any trick or an specific make tool to see if they can compile?

Regards

Hi, automake takes makefile.am and outputs makefile.in and configure inputs makefile.in and outputs makefile.
We need to rebuild all the auto stuff to make it work on OS/2, best to run autoreconf, in the root of the source,
Code: [Select]
sh $UNIXROOT/usr/bin/autoreconf -sfi

Which will do all the aclocal, automake, libtoolize and autoconf stuff. Also sometimes there is an autogen.sh which can be run to produce the auto files

Edit: fix the autoreconf parameter
« Last Edit: August 22, 2023, 05:19:15 pm by Dave Yeo »

Dave Yeo

  • Hero Member
  • *****
  • Posts: 5365
  • Karma: +127/-1
    • View Profile
Re: Compiling a SDL Game (2023)
« Reply #21 on: August 22, 2023, 04:11:55 am »
Once the updated configure script is generated, it is a good idea to run "sh configure --help 2&1 | tee configure.hlp" to see if there are any interesting parameters to pass and then run "sh configure 'LDFLAGS=-Zomf' 'LIBS=-lcx'" I think that is the right quoting. Add other parameters before LDFLAGS, things like --prefix=[path to install to, such as X:/tmp/lbreakout].
IIRC, lbreakout had problems with where to store the high scores on OS/2.

Dave Yeo

  • Hero Member
  • *****
  • Posts: 5365
  • Karma: +127/-1
    • View Profile
Re: Compiling a SDL Game (2023)
« Reply #22 on: August 22, 2023, 05:22:11 pm »
Tried compiling the version of lbreakout that you mentioned,
Code: [Select]
H:\tmp\lbreakouthd-1.1.3>sh w:/usr/bin/autoreconf -sfi
configure.ac:4: error: Autoconf version 2.71 or higher is required

So we need an autoconf update as ours is 2.69. Guess try an older version of lbreakout.
edit: changing the AC_PREREQ line from 2.71 to 2.69 seems all that is required to run autoconf successfully
« Last Edit: August 22, 2023, 05:32:52 pm by Dave Yeo »

Dave Yeo

  • Hero Member
  • *****
  • Posts: 5365
  • Karma: +127/-1
    • View Profile
Re: Compiling a SDL Game (2023)
« Reply #23 on: August 22, 2023, 05:45:17 pm »
OK built it with
Code: [Select]
sh configure --prefix=h:/tmp/lbreakouthd 'LDFLAGS=-Zomf -Zmap -Zbin-files -Zhigh-mem' LIBS=-lcx
make 2>&1 | tee make.log
make install

It got confused by my aspect ratio, see https://sourceforge.net/p/lgames/bugs/102/ and also the title was above my screen. Biggest problem is that it is slow, much slower then lbreakout2 and not fun to play. Probably expects accelerated 3D support.

Martin Iturbide

  • OS2World NewsMaster
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 5256
  • Karma: +44/-1
  • Your Friend Wil Declares...
    • View Profile
    • Martin's Personal Blog
Re: Compiling a SDL Game (2023)
« Reply #24 on: August 22, 2023, 06:43:40 pm »
OK built it with
Code: [Select]
sh configure --prefix=h:/tmp/lbreakouthd 'LDFLAGS=-Zomf -Zmap -Zbin-files -Zhigh-mem' LIBS=-lcx
make 2>&1 | tee make.log
make install

It got confused by my aspect ratio, see https://sourceforge.net/p/lgames/bugs/102/ and also the title was above my screen. Biggest problem is that it is slow, much slower then lbreakout2 and not fun to play. Probably expects accelerated 3D support.


Thanks Dave.

I'm getting this:

Quote
[C:\DEV\5TRYING\LBREAKOUTHD-1.1.3]sh configure --prefix=C:/tmp/lbreakouthd 'LDFLAGS=-Zomf -Zmap -Zbin-files -Zhigh-mem' LIBS=-lcx
checking for a BSD-compatible install... ./install-sh -c
checking whether build environment is sane... yes
checking for a race-free mkdir -p... ./install-sh -c -d
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... no
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether make supports the include directive... yes (GNU style)
checking for gcc... no
checking for cc... no
checking for cl.exe... no
checking for clang... no

[C:\DEV\5TRYING\LBREAKOUTHD-1.1.3]make   2>&1  | tee make.log
make: *** No targets specified and no makefile found.  Stop.

[C:\DEV\5TRYING\LBREAKOUTHD-1.1.3]make install
make: Nothing to be done for `install'.

It is like make does not find the makefine.

Regards
« Last Edit: August 22, 2023, 06:47:27 pm by Martin Iturbide »
Martin Iturbide
OS2World NewsMaster
... just share the dream.

Martin Iturbide

  • OS2World NewsMaster
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 5256
  • Karma: +44/-1
  • Your Friend Wil Declares...
    • View Profile
    • Martin's Personal Blog
Re: Compiling a SDL Game (2023)
« Reply #25 on: August 22, 2023, 06:44:31 pm »
OK built it with
Code: [Select]
sh configure --prefix=h:/tmp/lbreakouthd 'LDFLAGS=-Zomf -Zmap -Zbin-files -Zhigh-mem' LIBS=-lcx
make 2>&1 | tee make.log
make install

It got confused by my aspect ratio, see https://sourceforge.net/p/lgames/bugs/102/ and also the title was above my screen. Biggest problem is that it is slow, much slower then lbreakout2 and not fun to play. Probably expects accelerated 3D support.

Thanks Dave.

I'm getting this:

Quote
[C:\DEV\5TRYING\LBREAKOUTHD-1.1.3]sh configure --prefix=C:/tmp/lbreakouthd 'LDFLAGS=-Zomf -Zmap -Zbin-files -Zhigh-mem' LIBS=-lcx
checking for a BSD-compatible install... ./install-sh -c
checking whether build environment is sane... yes
checking for a race-free mkdir -p... ./install-sh -c -d
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... no
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether make supports the include directive... yes (GNU style)
checking for gcc... no
checking for cc... no
checking for cl.exe... no
checking for clang... no

[C:\DEV\5TRYING\LBREAKOUTHD-1.1.3]make   2>&1  | tee make.log
make: *** No targets specified and no makefile found.  Stop.

[C:\DEV\5TRYING\LBREAKOUTHD-1.1.3]make install
make: Nothing to be done for `install'.

I don't know why it says that can not find gcc, it is on my path.
It is like make does not find the makefile.

Regards
« Last Edit: August 22, 2023, 09:00:38 pm by Martin Iturbide »
Martin Iturbide
OS2World NewsMaster
... just share the dream.

Dave Yeo

  • Hero Member
  • *****
  • Posts: 5365
  • Karma: +127/-1
    • View Profile
Re: Compiling a SDL Game (2023)
« Reply #26 on: August 22, 2023, 07:38:29 pm »
You did do the autoreconf part first? It looks like you didn't and exeext=.exe is not set.
Edit: or you're missing something in the autotools department. autoconf, automake, libtool, libtool-ltdl-dev m4 and whatever I'm forgetting. Or possibly you are pulling in utilities from \os2 instead of @unixroot\usr.
« Last Edit: August 22, 2023, 07:46:43 pm by Dave Yeo »

Martin Iturbide

  • OS2World NewsMaster
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 5256
  • Karma: +44/-1
  • Your Friend Wil Declares...
    • View Profile
    • Martin's Personal Blog
Re: Compiling a SDL Game (2023)
« Reply #27 on: August 22, 2023, 09:17:22 pm »
My mistake, I forgot this:
edit: changing the AC_PREREQ line from 2.71 to 2.69 seems all that is required to run autoconf successfully
Martin Iturbide
OS2World NewsMaster
... just share the dream.

Martin Iturbide

  • OS2World NewsMaster
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 5256
  • Karma: +44/-1
  • Your Friend Wil Declares...
    • View Profile
    • Martin's Personal Blog
Re: Compiling a SDL Game (2023)
« Reply #28 on: August 22, 2023, 10:46:18 pm »
Hello Dave

It compiled and runs. Yes, I have the same issue, it is unplayable because it is very slow. But I think it had been a good learning experience with automake.

Regards
« Last Edit: August 22, 2023, 10:48:40 pm by Martin Iturbide »
Martin Iturbide
OS2World NewsMaster
... just share the dream.

Dave Yeo

  • Hero Member
  • *****
  • Posts: 5365
  • Karma: +127/-1
    • View Profile
Re: Compiling a SDL Game (2023)
« Reply #29 on: August 22, 2023, 11:49:03 pm »
I tried building lbreakout2, something I've done before. No joy, configure didn't add some libs (png, intl and SDL) and the level stuff is screwed up.
Code: [Select]
H:\tmp\lbreakout2-2.6.5\client>lbreakout2.exe
LBreakout2 2.6.5
Copyright 2001-2011 Michael Speck
Published under GNU GPL
---
Looking up data in: .
Looking up highscores in: .
Looking up custom levels in: W:\Home/.lgames/lbreakout2-levels
Compiled without sound and music
W:\Home/.lgames/lbreakout2.conf: file not found
Loading theme 'AbsoluteB'
Couldn't open ./gfx/H:/tmp/lbreakout2-2.6.5/client/gfx/AbsoluteB/bricks.png
Couldn't open ./gfx/H:/tmp/lbreakout2-2.6.5/client/gfx/AbsoluteB/bricks.png
Couldn't open ./gfx/H:/tmp/lbreakout2-2.6.5/client/gfx/AbsoluteB/paddle.png
Couldn't open ./gfx/H:/tmp/lbreakout2-2.6.5/client/gfx/AbsoluteB/paddle.png
Couldn't open ./gfx/H:/tmp/lbreakout2-2.6.5/client/gfx/AbsoluteB/weapon.png
Couldn't open ./gfx/H:/tmp/lbreakout2-2.6.5/client/gfx/AbsoluteB/weapon.png
Couldn't open ./gfx/H:/tmp/lbreakout2-2.6.5/client/gfx/AbsoluteB/shot.png
Couldn't open ./gfx/H:/tmp/lbreakout2-2.6.5/client/gfx/AbsoluteB/shot.png
Couldn't open ./gfx/H:/tmp/lbreakout2-2.6.5/client/gfx/AbsoluteB/extras.png
Couldn't open ./gfx/H:/tmp/lbreakout2-2.6.5/client/gfx/AbsoluteB/extras.png
Couldn't open ./gfx/H:/tmp/lbreakout2-2.6.5/client/gfx/AbsoluteB/fr_left.png
Couldn't open ./gfx/H:/tmp/lbreakout2-2.6.5/client/gfx/AbsoluteB/fr_left.png
Couldn't open ./gfx/H:/tmp/lbreakout2-2.6.5/client/gfx/AbsoluteB/fr_top.png
Couldn't open ./gfx/H:/tmp/lbreakout2-2.6.5/client/gfx/AbsoluteB/fr_top.png
Couldn't open ./gfx/H:/tmp/lbreakout2-2.6.5/client/gfx/AbsoluteB/fr_right.png
Couldn't open ./gfx/H:/tmp/lbreakout2-2.6.5/client/gfx/AbsoluteB/fr_right.png
Couldn't open ./gfx/H:/tmp/lbreakout2-2.6.5/client/gfx/AbsoluteB/life.png
Couldn't open ./gfx/H:/tmp/lbreakout2-2.6.5/client/gfx/AbsoluteB/life.png
Couldn't open ./gfx/H:/tmp/lbreakout2-2.6.5/client/gfx/AbsoluteB/back0.png
Fatal STK Error!
Couldn't open ./gfx/H:/tmp/lbreakout2-2.6.5/client/gfx/AbsoluteB/back0.png
GUI finalized
STK finalized
SDL finalized

Note the PATHS start with .gfx/H:
LBreakout2 is quite playable, lots of additional levels available, likely the same levels as LBreakout_hd uses.