Updated mingw.
authorblitz-research <blitzmunter@gamil.com>
Sat, 26 Sep 2015 21:48:10 +0000 (10:48 +1300)
committerblitz-research <blitzmunter@gamil.com>
Sat, 26 Sep 2015 21:48:10 +0000 (10:48 +1300)
src/bmk/bmk_util.bmx

index 5383aa215b39b34ec7daabb4565c201eed11eb7f..c3d97c389f4d3031bf0cff35fd30a62a83172721 100644 (file)
@@ -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