Recent

Author Topic: Docker image which can build both 16 and 32-bit MS-DOS apps  (Read 6360 times)

kveroneau

  • Full Member
  • ***
  • Posts: 119
Docker image which can build both 16 and 32-bit MS-DOS apps
« on: March 31, 2020, 03:13:30 am »
I thought this would be the best sub-forum to post this under...

Do you need a consistent easy to grab development environment to build both 16-bit real-mode and 32-bit protected mode ObjectPascal programs in?  Well, I have the solution for you!  If you have access to Docker, either in a VM on Windows/Mac, or natively on your Linux workstation, you can either build my Dockerfile yourself with your own customization and FPC version, or pull a ready made FPC 3.2.0 RC1 Docker image I slapped together today!

I have tested both the i8086 and GO32v2 FPC targets in this Docker image and can confirm they run in DOS as expected.  This is a beta version of the next FPC release, so be warned that there might be some bugs and such, but this could be your chance to try compiling your current 16-bit and 32-bit programs on the latest and greatest FPC version to see if they run as expected and of course open bug reports if you notice anything off.

Dockerfile in my GitHub repo: https://github.com/kveroneau/fpc-docker/tree/master/Builder/fpc320

Docker image in Docker Hub: https://hub.docker.com/layers/kveroneau/fpc/3.2.0/images/sha256-e64ed3081691278903372ef8c5db72338bff6e4af4f5a7f964bc0045db93d4fd?context=explore

Command you can run right now(if you have Docker installed):

Code: Bash  [Select][+][-]
  1. $ docker run -it --rm -v `pwd`:/usr/src kveroneau/fpc:3.2.0
  2.  

This will make your current working directory available under /usr/src in the Docker container when it runs, so run this command in a directory where you have some source code you'd like to try and compile against FPC 3.2.0.

Here is how you can build for each target:

Code: GNU make  [Select][+][-]
  1. all: hello.com hello.exe hello32.exe
  2.  
  3. hello.com: hello.pas
  4.         ppcross8086 -o$@ -WmTiny -Wtcom $<
  5.  
  6. hello.exe: hello.pas
  7.         ppcross8086 -o$@ -WmTiny -Wtexe $<
  8.  
  9. hello32.exe: hello.pas
  10.         ppcross386 -o$@ -Tgo32v2 $<
  11.  
  12. clean:
  13.         rm -rf *.com *.exe *.a *.o
  14.  

If you used the docker command-line provided above, your host operating system should now contain a couple .EXE files and a .COM file within the same source directory you shared with the Docker container.  Easy stuff.

What is even cooler about this, is that you can create a nice shell script to run a Makefile from the current directory inside the Docker container, eg:

Code: Bash  [Select][+][-]
  1. #!/bin/sh
  2.  
  3. docker run -it --rm -v `pwd`:/usr/src kveroneau/fpc:3.2.0 make "$@"
  4.  

Running this script will spin up a temporary docker container to clean-room build your sources in the current directory using a modern Makefile.  When the docker container finishes, you should then see your binary files and also see the output from Make on your standard output.  This can obviously be used on something like a build server like Jenkins or CircleCI to automate builds.

Let me know if anybody has any questions, or needs some assistance in getting Docker up and running on their machines.

kveroneau

  • Full Member
  • ***
  • Posts: 119
Re: Docker image which can build both 16 and 32-bit MS-DOS apps
« Reply #1 on: September 23, 2021, 11:12:18 pm »
Just pushed a new Docker image for FPC 3.2.2, the current stable release.

https://hub.docker.com/repository/registry-1.docker.io/kveroneau/fpc/tags

This image contains the standard AMD64 compiler, along with both the Go32v2 and the i8086 builder.

The Git repo has also been updated with the latest Dockerfile and related files here:
https://github.com/kveroneau/fpc-docker/tree/master/Builder/fpc322

It can be used in the exact same way as the previous image.

Ñuño_Martínez

  • Hero Member
  • *****
  • Posts: 1186
    • Burdjia
Re: Docker image which can build both 16 and 32-bit MS-DOS apps
« Reply #2 on: October 02, 2021, 01:47:02 pm »
Great.  I have to remember this, and test it.

Thanks for the effort.
Are you interested in game programming? Join the Pascal Game Development community!
Also visit the Game Development Portal

 

TinyPortal © 2005-2018