Skip to content

Commit

Permalink
Windows binaries and build instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
Galladite27 committed Apr 9, 2023
1 parent 6ccbb4b commit 6b167b8
Show file tree
Hide file tree
Showing 9 changed files with 1,829 additions and 2 deletions.
3 changes: 2 additions & 1 deletion BUGS
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ BUGS OR MISFEATURES
* Using rgosub causes rmenu not to be displayed during select command.
(high on priority list)

* The windows build is failing. Working on this.
* The windows build uses system libraries (but can still build a
portable executable)

FEATURES REQUESTED

Expand Down
8 changes: 8 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
2023-04-09
The numbering scheme for releases is slightly off, but the next time
I publish a release I'll make sure they're all right.

No major changes to the source code this time, but there are now
build instructions and custom Makefiles for Windows, as well as
pre-compiled binaries, courtesy of Seung Park.

2023-03-08
Slight bugfixes in regards to linker flags, but more work needs to be done

Expand Down
16 changes: 16 additions & 0 deletions INSTALL
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,22 @@ This will use gcc by default; to use icc, start with
CC=icc ./configure


* WINDOWS COMPILATION GUIDE

There is a separate makefile for use with Windows + MSYS2. To use it,
copy the relevant makefile (32 or 64 bit) from msys2 into the main
directory, and then follow the instructions in "msys2/README.md".

It is worth noting that as of now, Windows builds cannot use the
custom versions of libraries found in "extlib/src", however it is on
my todo-list not only to fix this but also to integrate the custom
Windows configure script and compilation methods into the normal
configure script.

Information in the below sections may be invalid for Windows builds.
Thanks to Seung Park of insani.org for providing these resources.


* DEALING WITH UNHELPFUL LIBRARIES

Some system-provided libraries are not ideally configured for use with
Expand Down
339 changes: 339 additions & 0 deletions msys2/LICENSE

Large diffs are not rendered by default.

168 changes: 168 additions & 0 deletions msys2/Makefile.Windows.MSYS2.i686.insani
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
# -*- Makefile.insani for onscripter-en -*-
#
# This is a Makefile for onscripter-en, but with additional insanity spirit. This Makefile is specific for Windows and MSYS2.
# Do not use this Makefile for any other reason. Furthermore, this Makefile has been heavily modified from the original autoconfigured
# Makefile. Primarily, the following has occurred:
#
# - All extlibs stripped out
# - Explicitly linking the necessary system libraries
# - Explicitly linking the necessary library dependencies
# - Destroy 32-bit/64-bit confusion
# - Disallow the -Werror flag
#
# This Makefile is not intended for true production use; it is instead made to help the *NScripter Work Group in their continued
# explorations and optimizations of code. Using this as a reference, it should be easily possible to make the 32-bit Windows build that
# the *NScripter Work Group desires.
#
# This version of the Makefile spits out an i686 Win32 binary. SHINING CAR OF CHAOSKAISER'S DREAMS ACHIEVED.

WIN32=true
OBJSUFFIX=.o
LIBSUFFIX=.a
EXESUFFIX=.exe

PREFIX ?= /mingw64

# Extra handling for internal libraries.
EXTRADEPS=
# NEWLDFLAGS was added because I wanted a quick place to put extra linker arguments while I was updating dependencies -Galladite 2023-2-11
# Need to remove pulse audio support from whatever is using it - either that or conditionally include this based on build target
#NEWLDFLAGS = -lpulse-simple -lpulse
INTERNAL_SDL=$(findstring true,false)
INTERNAL_SMPEG=$(findstring true,false)
INTERNAL_LIBPNG=$(findstring true,false)
INTERNAL_LIBJPEG=$(findstring true,false)
INTERNAL_OGGLIBS=$(findstring true,false)
SDL_CONFIG=sdl-config

#export PATH := $(shell pwd)/extlib/bin:$(PATH)
#export CFLAGS := -I$(shell pwd)/extlib/include $(CFLAGS)
#export CPPFLAGS := -I$(shell pwd)/extlib/include $(CPPFLAGS)
#export LDFLAGS := -L$(shell pwd)/extlib/lib $(LDFLAGS)
export CSTD := -std=c99
export CXXSTD := -std=c++98

export CC := gcc
export CXX := g++
export MAKE := make
export GNUMAKE := makeforc
export AR := ar
export RANLIB := ranlib
export LD := c++ -m32 -o

# ONScripter variables
OSCFLAGSEXTRA = -Wall -DUSE_X86_GFX $(OSCTMPFLAGS)
INCS = $(shell $(SDL_CONFIG) --cflags) \
$(shell smpeg-config --cflags) \
$(shell pkg-config freetype2 --cflags)

GNURX_DIR = tools/libgnurx
TOOL_EXTRA_INCS = -I$(GNURX_DIR)
TOOL_EXTRADEPS = $(GNURX_DIR)/libgnurx.a
TOOL_EXTRA_CLEAN = clean_libgnurx
TOOL_LIBS = -Wl,--start-group \
-ljpeg -lpng -lz \
-L$(GNURX_DIR) -lgnurx \
-lbz2 -Wl,--end-group
LIBS = -static -Wl,--start-group \
$(shell $(SDL_CONFIG) --static-libs) \
-lSDL_ttf \
$(shell smpeg-config --libs) $(shell pkg-config freetype2 --libs) \
-lSDL_image -ljpeg -lpng -lz \
-lSDL_mixer -logg -lvorbis -lvorbisfile \
-lbrotlidec -lbrotlicommon -lharfbuzz -ltiff -lwebp -lmad -lgraphite2 -ljbig -lsharpyuv -lzstd -ldeflate -lLerc -llzma -liconv -ldinput -lwinmm -ldxguid -lrpcrt4 \
-lusp10 \
-lbz2 -Wl,--end-group

# Remove -DUSE_MESSAGEBOX if you don't want Windows dialog boxes
DEFS = -DWIN32 -DUSE_MESSAGEBOX -DUSE_OGG_VORBIS
EXT_OBJS = SDL_win32_main.o win32rc.o graphics_mmx.o graphics_sse2.o


.SUFFIXES:
.SUFFIXES: .o .cpp .h .c

ifdef DEBUG
OSCFLAGS = -O0 -g -pg -ggdb -pipe -Wpointer-arith -Wall $(OSCFLAGSEXTRA)
export LDFLAGS := -pg $(LDFLAGS)
else
ifdef PROF
OSCFLAGS = -O3 -pg -pipe -Wpointer-arith -Wall $(OSCFLAGSEXTRA)
export LDFLAGS := -pg $(LDFLAGS)
else
OSCFLAGS = -O3 -fomit-frame-pointer -pipe -Wpointer-arith -Wall $(OSCFLAGSEXTRA)
endif
endif

TARGET ?= onscripter-en

binary: $(TARGET).exe

.PHONY: all clean distclean tools binary
all: $(TARGET).exe tools

SDLOTHERCONFIG :=
OTHERCONFIG :=

OTHER_OBJS =
RC_HDRS =

#include Makefile.extlibs
include Makefile.onscripter

.PHONY: libtoolreplace
libtoolreplace:
@cp $(ES)/required/freetype-config $(EB)

clean: pclean $(CLEAN_TARGETS) libtoolreplace
distclean: clean pdistclean $(DISTCLEAN_TARGETS)
rm -r -f extlib/bin extlib/lib extlib/include \
extlib/share extlib/man
rm -f Makefile SDL.dll

install-bin:
./install-sh -c -s $(TARGET) $(PREFIX)/bin/$(TARGET)
install: install-bin
uninstall:
rm $(PREFIX)/bin/$(TARGET)

RCFILE ?= onscripter.rc
WICONFILE ?= ons-en.ico
RCCLEAN = $(RCFILE)
win32rc.o: $(RCFILE) $(WICONFILE)
windres $< -o $@

%.rc: %.rc.in version.h winres.h
ver=`awk '/define VER_NUMBER/ { print $$3 }' version.h`; \
y=`expr substr $$ver 1 4`; \
m=`expr substr $$ver 5 2`; mn=`expr $$m + 0`; \
d=`expr substr $$ver 7 2`; dn=`expr $$d + 0`; \
i=\"$(WICONFILE)\"; \
sed -e "s/@Y@/$$y/g;s/@0M@/$$m/g;s/@M@/$$mn/g;s/@0D@/$$d/g;s/@D@/$$dn/g;s%@I@%$$i%g" $< > $@

SDL_win32_main.o: SDL_win32_main.c
$(CC) $(CSTD) $(OSCFLAGS) $(INCS) $(DEFS) -c $< -o $@

$(GNURX_DIR)/libgnurx.a:
$(MAKE) -C $(GNURX_DIR) libgnurx.a

.PHONY: clean_libgnurx
clean_libgnurx:
$(MAKE) -C $(GNURX_DIR) clean


graphics_sse2.o: graphics_sse2.cpp graphics_sse2.h graphics_common.h graphics_sum.h graphics_blend.h
$(CXX) $(CXXSTD) $(OSCFLAGS) $(INCS) $(DEFS) -fpermissive -msse2 -DUSE_X86_GFX -c $< -o $@

graphics_mmx.o: graphics_mmx.cpp graphics_mmx.h graphics_common.h graphics_sum.h
$(CXX) $(CXXSTD) $(OSCFLAGS) $(INCS) $(DEFS) -fpermissive -mmmx -DUSE_X86_GFX -c $< -o $@

.PHONY: dist
dist:
svn export . onscripter-en-20230308
tar cf onscripter-en-20230308-fullsrc.tar onscripter-en-20230308
rm -rf onscripter-en-20230308/extlib onscripter-en-20230308/win_dll \
onscripter-en-20230308/tools/libgnurx
tar cf onscripter-en-20230308-src.tar onscripter-en-20230308
bzip2 -9 onscripter-en-20230308-*src.tar
rm -rf onscripter-en-20230308
168 changes: 168 additions & 0 deletions msys2/Makefile.Windows.MSYS2.x86-64.insani
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
# -*- Makefile.insani for onscripter-en -*-
#
# This is a Makefile for onscripter-en, but with additional insanity spirit. This Makefile is specific for Windows and MSYS2.
# Do not use this Makefile for any other reason. Furthermore, this Makefile has been heavily modified from the original autoconfigured
# Makefile. Primarily, the following has occurred:
#
# - All extlibs stripped out
# - Explicitly linking the necessary system libraries
# - Explicitly linking the necessary library dependencies
# - Destroy 32-bit/64-bit confusion
# - Disallow the -Werror flag
#
# This Makefile is not intended for true production use; it is instead made to help the *NScripter Work Group in their continued
# explorations and optimizations of code. Using this as a reference, it should be easily possible to make the 32-bit Windows build that
# the *NScripter Work Group desires.
#
# However, this is not the SHINING CAR OF INSANI'S DREAMS, so I cannot SHOW YOU THE WAY FOR LOVING (32-BIT BUILDS). My most profound
# apologies.

WIN32=true
OBJSUFFIX=.o
LIBSUFFIX=.a
EXESUFFIX=.exe

PREFIX ?= /mingw64

# Extra handling for internal libraries.
EXTRADEPS=
# NEWLDFLAGS was added because I wanted a quick place to put extra linker arguments while I was updating dependencies -Galladite 2023-2-11
# Need to remove pulse audio support from whatever is using it - either that or conditionally include this based on build target
#NEWLDFLAGS = -lpulse-simple -lpulse
INTERNAL_SDL=$(findstring true,false)
INTERNAL_SMPEG=$(findstring true,false)
INTERNAL_LIBPNG=$(findstring true,false)
INTERNAL_LIBJPEG=$(findstring true,false)
INTERNAL_OGGLIBS=$(findstring true,false)
SDL_CONFIG=sdl-config

#export PATH := $(shell pwd)/extlib/bin:$(PATH)
#export CFLAGS := -I$(shell pwd)/extlib/include $(CFLAGS)
#export CPPFLAGS := -I$(shell pwd)/extlib/include $(CPPFLAGS)
#export LDFLAGS := -L$(shell pwd)/extlib/lib $(LDFLAGS)
export CSTD := -std=c99
export CXXSTD := -std=c++98

export CC := gcc
export CXX := g++
export MAKE := make
export GNUMAKE := makeforc
export AR := ar
export RANLIB := ranlib
export LD := c++ -m64 -o

# ONScripter variables
OSCFLAGSEXTRA = -Wall -DUSE_X86_GFX $(OSCTMPFLAGS)
INCS = $(shell $(SDL_CONFIG) --cflags) \
$(shell smpeg-config --cflags) \
$(shell pkg-config freetype2 --cflags)

GNURX_DIR = tools/libgnurx
TOOL_EXTRA_INCS = -I$(GNURX_DIR)
TOOL_EXTRADEPS = $(GNURX_DIR)/libgnurx.a
TOOL_EXTRA_CLEAN = clean_libgnurx
TOOL_LIBS = -Wl,--start-group \
-ljpeg -lpng -lz \
-L$(GNURX_DIR) -lgnurx \
-lbz2 -Wl,--end-group
LIBS = -static -Wl,--start-group \
$(shell $(SDL_CONFIG) --static-libs) \
-lSDL_ttf \
$(shell smpeg-config --libs) $(shell pkg-config freetype2 --libs) \
-lSDL_image -ljpeg -lpng -lz \
-lSDL_mixer -logg -lvorbis -lvorbisfile \
-lbrotlidec -lbrotlicommon -lharfbuzz -ltiff -lwebp -lmad -lgraphite2 -ljbig -lsharpyuv -lzstd -ldeflate -lLerc -llzma -liconv -ldinput -lwinmm -ldxguid -lrpcrt4 \
-lbz2 -Wl,--end-group

# Remove -DUSE_MESSAGEBOX if you don't want Windows dialog boxes
DEFS = -DWIN32 -DUSE_MESSAGEBOX -DUSE_OGG_VORBIS
EXT_OBJS = SDL_win32_main.o win32rc.o graphics_mmx.o graphics_sse2.o


.SUFFIXES:
.SUFFIXES: .o .cpp .h .c

ifdef DEBUG
OSCFLAGS = -O0 -g -pg -ggdb -pipe -Wpointer-arith -Wall $(OSCFLAGSEXTRA)
export LDFLAGS := -pg $(LDFLAGS)
else
ifdef PROF
OSCFLAGS = -O3 -pg -pipe -Wpointer-arith -Wall $(OSCFLAGSEXTRA)
export LDFLAGS := -pg $(LDFLAGS)
else
OSCFLAGS = -O3 -fomit-frame-pointer -pipe -Wpointer-arith -Wall $(OSCFLAGSEXTRA)
endif
endif

TARGET ?= onscripter-en

binary: $(TARGET).exe

.PHONY: all clean distclean tools binary
all: $(TARGET).exe tools

SDLOTHERCONFIG :=
OTHERCONFIG :=

OTHER_OBJS =
RC_HDRS =

#include Makefile.extlibs
include Makefile.onscripter

.PHONY: libtoolreplace
libtoolreplace:
@cp $(ES)/required/freetype-config $(EB)

clean: pclean $(CLEAN_TARGETS) libtoolreplace
distclean: clean pdistclean $(DISTCLEAN_TARGETS)
rm -r -f extlib/bin extlib/lib extlib/include \
extlib/share extlib/man
rm -f Makefile SDL.dll

install-bin:
./install-sh -c -s $(TARGET) $(PREFIX)/bin/$(TARGET)
install: install-bin
uninstall:
rm $(PREFIX)/bin/$(TARGET)

RCFILE ?= onscripter.rc
WICONFILE ?= ons-en.ico
RCCLEAN = $(RCFILE)
win32rc.o: $(RCFILE) $(WICONFILE)
windres $< -o $@

%.rc: %.rc.in version.h winres.h
ver=`awk '/define VER_NUMBER/ { print $$3 }' version.h`; \
y=`expr substr $$ver 1 4`; \
m=`expr substr $$ver 5 2`; mn=`expr $$m + 0`; \
d=`expr substr $$ver 7 2`; dn=`expr $$d + 0`; \
i=\"$(WICONFILE)\"; \
sed -e "s/@Y@/$$y/g;s/@0M@/$$m/g;s/@M@/$$mn/g;s/@0D@/$$d/g;s/@D@/$$dn/g;s%@I@%$$i%g" $< > $@

SDL_win32_main.o: SDL_win32_main.c
$(CC) $(CSTD) $(OSCFLAGS) $(INCS) $(DEFS) -c $< -o $@

$(GNURX_DIR)/libgnurx.a:
$(MAKE) -C $(GNURX_DIR) libgnurx.a

.PHONY: clean_libgnurx
clean_libgnurx:
$(MAKE) -C $(GNURX_DIR) clean


graphics_sse2.o: graphics_sse2.cpp graphics_sse2.h graphics_common.h graphics_sum.h graphics_blend.h
$(CXX) $(CXXSTD) $(OSCFLAGS) $(INCS) $(DEFS) -fpermissive -msse2 -DUSE_X86_GFX -c $< -o $@

graphics_mmx.o: graphics_mmx.cpp graphics_mmx.h graphics_common.h graphics_sum.h
$(CXX) $(CXXSTD) $(OSCFLAGS) $(INCS) $(DEFS) -fpermissive -mmmx -DUSE_X86_GFX -c $< -o $@

.PHONY: dist
dist:
svn export . onscripter-en-20230308
tar cf onscripter-en-20230308-fullsrc.tar onscripter-en-20230308
rm -rf onscripter-en-20230308/extlib onscripter-en-20230308/win_dll \
onscripter-en-20230308/tools/libgnurx
tar cf onscripter-en-20230308-src.tar onscripter-en-20230308
bzip2 -9 onscripter-en-20230308-*src.tar
rm -rf onscripter-en-20230308
Loading

0 comments on commit 6b167b8

Please sign in to comment.