How to do a port for MorphOS?
  • Yokemate of Keyboards
    Yokemate of Keyboards
    Papiosaur
    Posts: 2256 from 2003/4/10
    From: France
    Hello all,

    This an english translation of my french post on meta-morphos.org

    Maybe it could help some guys want to try to port software or games available on Github or SourceForge (or others places) for MorphOS.

    To make it "very quick and very simple":

    Of course, you need to install MorphOS SDK to continue :-)

    In my different ports, I put the Makefile (a script that will generate the executable) in the archive (in Sources.lha in the root of the archive).

    In this file, there are several parameters to adapt depending on the project to be ported:

    - the type of files to compile .c or .cpp (c++),
    - the name of the associated compiler (ppc-morphos-gcc-9 for c and ppc-morphos-g++-9 for c++),
    - the necessary libraries: SDL2 (-lSDL2, etc...), OpenGL (-lGL), GLUT (-lGLU), etc.,
    - the location of the files to be compiled (src/*.c will compile all the .c files in the src directory)
    - the location of the includes (.h or headers, example -Iinclude)
    Note: You could have .cc and .hh too
    - the name of the executable that will be generated

    For each project, it is necessary to adapt:

    - the Makefile according to the characteristics of the game to be ported
    - correct the "errors" that are displayed during compilation in the files concerned
    - correct the paths of the data files (images, music, etc.) if necessary.

    To compile, you have to go to a shell, do cd "the project path" then "make" to launch the Makefile script.

    The Makefile script will generate .o (object) files from the .c or .cpp files then assemble (link) all these .o files to make an executable file

    You can do "make clean" to clean a project compiled to restart the compilation after making corrections.

    You can also launch "make", correct the error then restart "make" which will resume at the file that had an "error"
    The "warnings" are not necessary important and do not stop the compilation (the "error" yes).

    The ideal is to take my first ports and try for yourself ;-)

    I thank BeWorld again for helping me so far and for the continuation of my projects for MorphOS.

    It's a quick "tutorial", i will improve it soon and realize a PDF in different langages.

    [ Edité par Papiosaur 28.12.2024 - 10:12 ]
  • »27.12.24 - 18:57
    Profile Visit Website
  • jPV
  • Yokemate of Keyboards
    Yokemate of Keyboards
    jPV
    Posts: 2110 from 2003/2/24
    From: po-RNO
    I would also enable some debug options in boot.img to reveal memory related etc. bugs in the ported code. We want our programs well-tested and as stable as possible.

    I'd make sure that at least ramdebug is enabled (might not be on Pegs or so) and InvZeroPage and PermMemTrack are enabled in the edebugflags.

    Adding this to your boot line should do the trick:
    Code:
     rd ed="InvZeroPage PermMemTrack"


    And if editing it to the Boot:bootinfo.txt file on a Mac, remember to bless it before rebooting (HFSSetMacBoot Boot:bootinfo.txt), otherwise you may need to boot from some other media to fix it.

    PermMemTrack may slow your system slightly, but it should be enabled for developers, or users who want to build as stable system as possible.

    Remember to check the ramdebuglog with, for example, the Debug screenbar module or with the GetRAMDebugLog shell command.
  • »28.12.24 - 08:10
    Profile Visit Website