From e91e0ded45ff1859ec9004e142f2d49fd1106044 Mon Sep 17 00:00:00 2001 From: blitz-research Date: Sun, 27 Sep 2015 10:48:10 +1300 Subject: [PATCH] Updated mingw. --- src/bmk/bmk_util.bmx | 126 +++++++++++++++++++++++++++++-------------- 1 file changed, 87 insertions(+), 39 deletions(-) diff --git a/src/bmk/bmk_util.bmx b/src/bmk/bmk_util.bmx index 5383aa2..c3d97c3 100644 --- a/src/bmk/bmk_util.bmx +++ b/src/bmk/bmk_util.bmx @@ -227,7 +227,9 @@ Function CreateArc( path$ , oobjs:TList ) EndIf cmd="" EndIf + If Not cmd cmd="ar -r "+CQuote(path) + cmd:+" "+CQuote(t) Next ?MacOS @@ -289,57 +291,102 @@ Function LinkApp( path$,lnk_files:TList,makelib ) files:+t+Chr(10) EndIf Next + cmd:+" -lSystem -framework CoreServices -framework CoreFoundation" + ?Win32 - cmd=CQuote(BlitzMaxPath()+"/bin/ld.exe")+" -s -stack 4194304" 'symbol stripping enabled - If opt_apptype="gui" cmd:+" -subsystem windows" - If makelib cmd:+" -shared" -' -m means something else in ld! -' cmd:+" -m32" + cmd=CQuote(BlitzMaxPath()+"/bin/ld.exe") - cmd:+" -o "+CQuote( path ) - cmd:+" "+CQuote( "-L"+CQuote( BlitzMaxPath()+"/lib" ) ) - - If makelib - Local imp$=StripExt(path)+".a" - Local def$=StripExt(path)+".def" - If FileType( def )<>FILETYPE_FILE Throw "Cannot locate .def file" - cmd:+" "+def - cmd:+" --out-implib "+imp - files:+"~n"+CQuote( BlitzMaxPath()+"/lib/dllcrt2.o" ) + If FileType( cmd )<>FILETYPE_FILE + + 'New style link using g++ + + cmd="g++ -m32 -static -s " + + If opt_apptype="gui" cmd:+" -mwindows" + + cmd:+" -o "+CQuote( path ) + cmd:+" "+CQuote( "-L"+CQuote( BlitzMaxPath()+"/lib" ) ) + + Local xpmanifest$ + For Local f$=EachIn lnk_files + Local t$=CQuote( f ) + If opt_dumpbuild Or (t[..1]="-" And t[..2]<>"-l") + cmd:+" "+t + Else + If f.EndsWith( "/win32maxguiex.mod/xpmanifest.o" ) + xpmanifest=t + Else + files:+" "+t + EndIf + EndIf + Next + + If xpmanifest files:+" "+xpmanifest + + files:+"~n-lgdi32 -lwsock32 -lwinmm -ladvapi32" + files:+" -lstdc++ -lpthread -lgcc -lmingwex -lmingw32 -lmoldname -lmsvcrt -luser32 -lkernel32" + + cmd:+" @"+CQuote( tmpfile ) + Else - files:+"~n"+CQuote( BlitzMaxPath()+"/lib/crtbegin.o" ) - files:+"~n"+CQuote( BlitzMaxPath()+"/lib/crt2.o" ) - EndIf - - 'Unholy!!!!! - Local xpmanifest$ - For Local f$=EachIn lnk_files - Local t$=CQuote( f ) - If opt_dumpbuild Or (t[..1]="-" And t[..2]<>"-l") - cmd:+" "+t + + 'Old style link using bin/ld.exe + + cmd:+" --oformat pei-i386" + + cmd:+" -s -stack 4194304" 'symbol stripping enabled + + If opt_apptype="gui" cmd:+" -subsystem windows" + + If makelib cmd:+" -shared" + + cmd:+" -o "+CQuote( path ) + cmd:+" "+CQuote( "-L"+CQuote( BlitzMaxPath()+"/lib" ) ) + + If makelib + Local imp$=StripExt(path)+".a" + Local def$=StripExt(path)+".def" + If FileType( def )<>FILETYPE_FILE Throw "Cannot locate .def file" + cmd:+" "+def + cmd:+" --out-implib "+imp + files:+"~n"+CQuote( BlitzMaxPath()+"/lib/dllcrt2.o" ) Else - If f.EndsWith( "/win32maxguiex.mod/xpmanifest.o" ) - xpmanifest=t + files:+"~n"+CQuote( BlitzMaxPath()+"/lib/crtbegin.o" ) + files:+"~n"+CQuote( BlitzMaxPath()+"/lib/crt2.o" ) + EndIf + + 'Unholy!!!!! + Local xpmanifest$ + For Local f$=EachIn lnk_files + Local t$=CQuote( f ) + If opt_dumpbuild Or (t[..1]="-" And t[..2]<>"-l") + cmd:+" "+t Else - files:+"~n"+t + If f.EndsWith( "/win32maxguiex.mod/xpmanifest.o" ) + xpmanifest=t + Else + files:+"~n"+t + EndIf EndIf + Next + + If xpmanifest files:+"~n"+xpmanifest + + cmd:+" "+CQuote( tmpfile ) + + files:+"~n-lgdi32 -lwsock32 -lwinmm -ladvapi32" + files:+" -lstdc++ -lpthread -lgcc -lmingwex -lmingw32 -lmoldname -lmsvcrt -luser32 -lkernel32" + + If Not makelib + files:+" "+CQuote( BlitzMaxPath()+"/lib/crtend.o" ) EndIf - Next - - If xpmanifest files:+"~n"+xpmanifest - cmd:+" "+CQuote( tmpfile ) - - files:+"~n-lgdi32 -lwsock32 -lwinmm -ladvapi32" - files:+" -lstdc++ -lpthread -lgcc -lmingwex -lmingw32 -lmoldname -lmsvcrt -luser32 -lkernel32" + files="INPUT("+files+")" - If Not makelib - files:+" "+CQuote( BlitzMaxPath()+"/lib/crtend.o" ) - EndIf + Endif - files="INPUT("+files+")" ?Linux cmd="g++" @@ -363,6 +410,7 @@ Function LinkApp( path$,lnk_files:TList,makelib ) files="INPUT("+files+")" ? + Local t$=getenv_( "BMK_LD_OPTS" ) If t cmd:+" "+t -- 2.30.2