-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial support for the mingw platform
- Loading branch information
Showing
6 changed files
with
208 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# Copyright (c) 2018 Damien Ciabrini | ||
# This file is part of ngdevkit | ||
# | ||
# ngdevkit is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU Lesser General Public License as | ||
# published by the Free Software Foundation, either version 3 of the | ||
# License, or (at your option) any later version. | ||
# | ||
# ngdevkit is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU Lesser General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU Lesser General Public License | ||
# along with ngdevkit. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
include Makefile | ||
|
||
ifeq ($(strip $(GNGEO_INSTALL_PATH)),) | ||
$(error Missing GnGEO installation path (GNGEO_INSTALL_PATH). See README.mingw for more details) | ||
else | ||
GNGEO_CFG=$(GNGEO_INSTALL_PATH)/conf/gngeorc | ||
endif | ||
|
||
ifeq ($(strip $(SDL2_DLL)),) | ||
$(error Missing path to SDL2.dll (SDL2_DLL). See README.mingw for more details) | ||
endif | ||
|
||
# default mingw compiler | ||
ifeq ($(strip $(MINGW_GCC)),) | ||
MINGW_GCC=$(shell uname -p)-w64-mingw32-gcc | ||
endif | ||
|
||
ifeq ($(strip $(ZLIB1_DLL)),) | ||
ZLIB1_DLL=$(shell $(MINGW_GCC) -print-file-name=zlib1.dll) | ||
endif | ||
|
||
GNGEO_BUILD_FLAGS=--enable-mingw --host=x86_64-w64-mingw32 --prefix=$(GNGEO_INSTALL_PATH) CPPFLAGS="-I$(LOCALDIR)/include" CFLAGS="-I$(LOCALDIR)/include" LDFLAGS="-L$(LOCALDIR)/lib" | ||
|
||
all: install-emulator-dll | ||
install-emulator-dll: build-emulator | ||
cp $(SDL2_DLL) $(GNGEO_INSTALL_PATH) && \ | ||
cp $(ZLIB1_DLL) $(GNGEO_INSTALL_PATH) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
# Compiling ngdevkit on the Windows platform | ||
|
||
Compiling the devkit for Windows 10 is supported via [WSL][wsl]: | ||
|
||
* The devkit generates Linux binaries that can be used from your | ||
Linux environment or called like a regular Windows command via | ||
WSL's [interoperability wrapper][interop]. | ||
|
||
* The GnGeo emulator is a native Windows GUI application. You | ||
can call it from both Linux and Windows and don't need a | ||
X server to run it. | ||
|
||
* The source-level debugging extension is not available yet. | ||
|
||
You need to run a couple of manual steps before being able to compile | ||
the devkit. This documentation explains how to compile ngdevkit with | ||
Ubuntu on Windows. | ||
|
||
## Pre-requisite | ||
|
||
### Make sure you have an available WSL environment | ||
|
||
Follow the | ||
[WSL install documentation](https://docs.microsoft.com/en-us/windows/wsl/install-win10) | ||
to enable the WSL subsystem on your Windows host. | ||
|
||
Then go on the Windows store and choose a Linux distribution to | ||
install on your Windows 10 host. This documentation uses Ubuntu 16.04, | ||
but any other `apt`-based distribution should work the same. | ||
|
||
## Building the devkit | ||
|
||
### Configure the package repositories | ||
|
||
Edit `/etc/apt/sources.list` to make the source packages from `main` | ||
and `universe` repositories are available to apt. They are used to | ||
resolve the packages that need to be installed to build gcc and | ||
sdcc. Those two lines should be uncommented in | ||
`/etc/apt/sources.list`: | ||
|
||
deb-src http://archive.ubuntu.com/ubuntu/ xenial main restricted | ||
deb-src http://archive.ubuntu.com/ubuntu/ xenial universe | ||
|
||
### Install the dependencies | ||
|
||
Install the packages required to build the devkit's compilers and | ||
tools: | ||
|
||
sudo apt-get update | ||
sudo apt-get install gcc curl unzip | ||
GCC_VERSION_PKG=$(apt-cache depends gcc | awk '/Depends.*gcc/ {print $2}') | ||
sudo apt-get build-dep $GCC_VERSION_PKG | ||
sudo apt-get build-dep sdcc | ||
sudo apt-get install libsdl2-dev | ||
sudo apt-get install imagemagick | ||
sudo apt-get install python-pygame | ||
sudo apt-get install automake | ||
sudo apt-get install autoconf-archive | ||
|
||
Then install the mingw cross-compiler to build a native GnGeo binary, | ||
and install GnGeo's DLL dependencies: | ||
|
||
sudo apt-get install mingw-w64 | ||
sudo apt-get install libz-mingw-w64-dev | ||
|
||
### Download SDL2 runtime and development files | ||
|
||
You need to download the SDL2 development files (header, library, | ||
pkgconfig) and the redistributable SDL2 runtime binary | ||
(`SDL2.dll`) from the [SDL2 website](https://www.libsdl.org/download-2.0.php). | ||
For example: | ||
|
||
cd $HOME | ||
curl -LO https://www.libsdl.org/release/SDL2-devel-2.0.8-mingw.tar.gz | ||
curl -LO https://www.libsdl.org/release/SDL2-2.0.8-win32-x64.zip | ||
|
||
Extract the SDL dll somewhere and remember the location of that file | ||
for later: | ||
|
||
cd $HOME | ||
unzip SDL2-2.0.8-win32-x64.zip | ||
# this yields a file $HOME/SDL2.dll | ||
|
||
Extract the development files and install the mingw-specifc files | ||
into system's default location: | ||
|
||
tar xf SDL2-devel-2.0.8-mingw.tar.gz | ||
sudo cp -af SDL2-2.0.8/i686-w64-mingw32 SDL2-2.0.8/x86_64-w64-mingw32 /usr/local | ||
|
||
Note: even if Ubuntu's mingw package installs in `/usr`, SDL2 expects | ||
mingw to be located in `/usr/local`; so extract into that destination | ||
path, and let GnGeo autodetect it automatically during compilation. | ||
|
||
|
||
### Building the toolchain | ||
|
||
Unlike other platforms, a native Windows 10 GnGeo requires all | ||
its files to be located under a common directory. You need to | ||
configure that GnGeo installation directory directly in file | ||
`Makefile.config`. For example: | ||
|
||
GNGEO_INSTALL_PATH=/mnt/c/Users/ngdevkit/Desktop/gngeo | ||
|
||
Note: it's a good idea to choose a directory under `/mnt/c` if you | ||
want to run GnGeo easily from the Windows explorer. | ||
|
||
You also need to update `Makefile.config` to specify the location of | ||
file `SDL2.dll` that you extracted previously. This file will be | ||
copied to the GnGeo installation directory automatically when building | ||
the devkit. For example: | ||
|
||
SDL2_DLL=/home/ngdevkit/SDL2.dll | ||
|
||
Once this is done, you can build the devkit by using the dedicated | ||
mingw makefile: | ||
|
||
make -f Makefile.mingw | ||
|
||
And voilà! You can now use the devkit and the emulator as described | ||
in [the main README](README.md) file. | ||
|
||
[wsl]: https://docs.microsoft.com/en-us/windows/wsl/install-win10 | ||
[interop]: https://docs.microsoft.com/en-us/windows/wsl/interop |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters