Skip to content

Commit

Permalink
Fixed build for mingw32, fixed installer script.
Browse files Browse the repository at this point in the history
Checked to work with Proteus 8.13
  • Loading branch information
Pugnator committed May 2, 2023
1 parent b587d6a commit a0d42ed
Show file tree
Hide file tree
Showing 10 changed files with 1,059 additions and 1,075 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ LUATOOLS=""
ISCC := iscc

ifdef SystemRoot
MAKE := mingw32-make
MAKE := make
RM := rm -f
CP := copy
LUATOOLS := win32lua
Expand Down
3 changes: 3 additions & 0 deletions externals/installer/openvsm.iss
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}"

[Registry]
Root: "HKCU"; Subkey: "Environment"; ValueType: expandsz; ValueName: "LUAVSM"; ValueData: "{app}\LuaScripts"; Flags: deletevalue
Root: "HKLM"; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; \
ValueType: expandsz; ValueName: "Path"; ValueData: "{olddata};{app}\LuaScripts"; \
Check: NeedsAddPath('{app}\LuaScripts')

[Dirs]
Name: "{app}\LuaScripts"; Flags: uninsneveruninstall
Expand Down
2 changes: 1 addition & 1 deletion externals/lua/src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# Your platform. See PLATS for possible values.
PLAT= guess

CC= gcc -std=gnu99
CC= i686-w64-mingw32-cc -std=gnu99
CFLAGS= -O2 -Wall -Wextra -DLUA_COMPAT_5_3 $(SYSCFLAGS) $(MYCFLAGS)
LDFLAGS= $(SYSLDFLAGS) $(MYLDFLAGS)
LIBS= -lm $(SYSLIBS) $(MYLIBS)
Expand Down
4 changes: 2 additions & 2 deletions include/version.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#define FILEVER 1,0,0,0
#define PRODUCTVER 1,0,0,0
#define STRFILEVER "0.5.211\0"
#define STRPRODUCTVER "0.5.211\0"
#define STRFILEVER "0.6.213\0"
#define STRPRODUCTVER "0.6.213\0"
35 changes: 14 additions & 21 deletions src/Makefile
Original file line number Diff line number Diff line change
@@ -1,19 +1,11 @@
RELEASE=`../relgen.sh`
ifdef SystemRoot
MAKE=make
CC:=gcc
AR:=ar
OBJCOPY:=objcopy
STRIP:=strip
WINRES:=windres
else
MAKE=make
CC:=i686-w64-mingw32-gcc
AR:=i686-w64-mingw32-ar
OBJCOPY:=i686-w64-mingw32-objcopy
STRIP:=i686-w64-mingw32-strip
WINRES:=i686-w64-mingw32-windres
endif

MAKE=make
CC:= i686-w64-mingw32-cc
AR:= i686-w64-mingw32-ar
OBJCOPY:= objcopy
STRIP:= strip
WINRES:= windres

LIBDIR=../dll

Expand All @@ -22,7 +14,7 @@ DEV=device
XXD=../tools/bin2source.exe
LUAC=../tools/luac.exe
OPENVSMLIB?=$(LIBDIR)/openvsm
LIADIR=lua
LUADIR=lua

SRC:=vsmapi.c \
lua_pin.c \
Expand All @@ -44,12 +36,12 @@ $(MOD)/module_pin.lua
DEVICE=\
$(DEV)/device.lua

CFLAGS:=-O3 -gdwarf-2 -fgnu89-inline -std=gnu99 -g3 -Wno-unused-variable -static-libgcc -static-libstdc++ -I../include -Imodules \
-I../externals/$(LIADIR)/src -D__VERSION=\"$(shell ../relgen.sh)\"
CFLAGS:=-O3 -m32 -gdwarf-2 -fgnu89-inline -std=gnu99 -g3 -Wno-unused-variable -static-libgcc -static-libstdc++ -I../include -Imodules \
-I../externals/$(LUADIR)/src -D__VERSION=\"$(shell ../relgen.sh)\"

SLIB_CFLAGS:=-Wl,--export-all-symbols,--enable-auto-import

LDFLAGS:=../externals/$(LIADIR)/src/liblua.a -lm -static-libgcc -static-libstdc++
LDFLAGS:=-m32 ../externals/$(LUADIR)/src/liblua.a -lm -static-libgcc -static-libstdc++

OBJ=$(SRC:%.c=%.o) openvsm.res \
$(MOD)/module_bus.c.o $(MOD)/module_custom.c.o \
Expand All @@ -67,7 +59,7 @@ all: modules $(OPENVSMLIB).dll
$(XXD) $@ > $@.c

openvsm.res:
$(WINRES) openvsm.rc -O coff -o openvsm.res
$(WINRES) openvsm.rc --output-format=coff --target=pe-i386 -o openvsm.res

$(DEV)/device.c.o:
$(CC) -c -o $@ $(DEV)/device.mod.c $(CFLAGS)
Expand Down Expand Up @@ -102,12 +94,13 @@ $(OPENVSMLIB).dll: $(OBJ)
modules: $(LOBJ)
@echo "Lua modules compiled"

SUBDIRS:= . modules device bindings
SUBDIRS:= . modules device bindings ../externals/$(LUADIR)/src/

clean:
rm -f $(OPENVSMLIB).*
for dir in $(SUBDIRS); do \
rm -f $$dir/*.o; \
rm -f $$dir/*.res; \
rm -f $$dir/*.mod; \
rm -f $$dir/*.mod.c; \
done
Loading

0 comments on commit a0d42ed

Please sign in to comment.