Home

Awesome

Building DJGPP cross compiler on Windows, Mac OSX, Linux and FreeBSD.

build-djgpp : Build DJGPP cross compiler and binutils on Windows (MinGW/Cygwin), Mac OSX, Linux and FreeBSD.

Prebuilt binary files

If you don't want build DJGPP by yourself, you can download prebuilt DJGPP binary files for MinGW, OSX and Linux from GitHub Release page.

Requirement

Before running this script, you need to install these programs first :

Depending on your system, installation procedure maybe different.

On Debian/Ubuntu, you can install these programs by :

sudo apt-get update
sudo apt-get install bison flex curl gcc g++ make texinfo zlib1g-dev g++ unzip

Fedora :

sudo yum install gcc-c++ bison flex texinfo patch zlib-devel

MinGW :

mingw-get update
mingw-get install msys-unzip libz-dev msys-wget msys-bison msys-flex msys-patch

Configuration

Default install location is /usr/local/djgpp. You can change install location by setting environment variable DJGPP_PREFIX :

DJGPP_PREFIX=/usr/local/my-djgpp

Default support language is C and C++. You can change supported languages by setting environment variable ENABLE_LANGUAGES :

ENABLE_LANGUAGES=c,c++,f95,objc,obj-c++

Building DJGPP compiler

To build DJGPP, just run :

./build-djgpp.sh gcc-version

Currently supported gcc-version :

For example, to build DJGPP for gcc 12.2.0 :

./build-djgpp.sh 12.2.0

It will download all necessary files, build DJGPP compiler and binutils, and install it.

Using DJGPP compiler

There are 2 methods to run the compiler (BASE_DIR is your DJGPP install location).

BASE_DIR/bin/i586-pc-msdosdjgpp-g++ hello.cpp

If you are using Linux :

export PATH=BASE_DIR/i586-pc-msdosdjgpp/bin/:$PATH
export GCC_EXEC_PREFIX=BASE_DIR/lib/gcc/
g++ hello.cpp

Or, run :

source BASE_DIR/setenv

If you are using Windows command prompt :

PATH=BASE_DIR/i586-pc-msdosdjgpp/bin;%PATH%
set GCC_EXEC_PREFIX=BASE_DIR/lib/gcc/
g++ hello.cpp

Or, run :

BASE_DIR/setenv.bat

Supported DJGPP Utilities

Successful build

Thanks

This script is based on spec file from DJGPP source rpm files by Andris Pavenis :

http://ap1.pp.fi/djgpp/index.html