VirtualBox

Changeset 42606 in vbox


Ignore:
Timestamp:
Aug 5, 2012 6:51:59 PM (12 years ago)
Author:
vboxsync
Message:

configure.vbs: MinGW-w64.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/configure.vbs

    r42313 r42606  
    13851385
    13861386''
    1387 ' Checks for a MingW32 suitable for building the recompiler.
     1387' Checks for a MinGW32 suitable for building the recompiler.
    13881388'
    13891389' strOptW32API is currently ignored.
    13901390'
    1391 sub CheckForMingW(strOptMingw, strOptW32API)
    1392    dim strPathMingW, strPathW32API, str
    1393    PrintHdr "MinGW GCC v3.3.x + Binutils + Runtime + W32API"
     1391sub CheckForMinGW32(strOptMinGW32, strOptW32API)
     1392   dim strPathMingW32, strPathW32API, str
     1393   PrintHdr "MinGW32 GCC v3.3.x + Binutils + Runtime + W32API"
    13941394
    13951395   '
    13961396   ' Find the MinGW and W32API tools.
    13971397   '
    1398    strPathMingW = ""
     1398   strPathMingW32 = ""
    13991399   strPathW32API = ""
    14001400
    14011401   ' The specified path.
    1402    if (strPathMingW = "") And (strOptMingW <> "") then
    1403       if CheckForMingWSub(strOptMingW, strOptW32API) then
    1404          strPathMingW = strOptMingW
     1402   if (strPathMingW32 = "") And (strOptMinGW32 <> "") then
     1403      if CheckForMinGW32Sub(strOptMinGW32, strOptW32API) then
     1404         strPathMingW32 = strOptMinGW32
    14051405         strPathW32API = strOptW32API
    14061406      end if
     
    14081408
    14091409   ' The tools location (first).
    1410    if (strPathMingW = "") And (g_blnInternalFirst = True) then
     1410   if (strPathMingW32 = "") And (g_blnInternalFirst = True) then
    14111411      str = g_strPathDev & "/win.x86/mingw32/v3.3.3"
    14121412      str2 = g_strPathDev & "/win.x86/w32api/v2.5"
    1413       if CheckForMingWSub(str, str2) then
    1414          strPathMingW = str
     1413      if CheckForMinGW32Sub(str, str2) then
     1414         strPathMingW32 = str
    14151415         strPathW32API = str2
    14161416      end if
     
    14181418
    14191419   ' See if there is any gcc around.
    1420    if strPathMingW = "" then
     1420   if strPathMingW32 = "" then
    14211421      str = Which("mingw32-gcc.exe")
    14221422      if (str <> "") then
    14231423         str = PathParent(PathStripFilename(str))
    1424          if CheckForMingWSub(str, str) then strPathMingW = str
    1425       end if
    1426    end if
    1427 
    1428    if strPathMingW = "" then
     1424         if CheckForMinGW32Sub(str, str) then strPathMingW32 = str
     1425      end if
     1426   end if
     1427
     1428   if strPathMingW32 = "" then
    14291429      str = Which("gcc.exe")
    14301430      if (str <> "") then
    14311431         str = PathParent(PathStripFilename(str))
    1432          if CheckForMingWSub(str, str) then strPathMingW = str
     1432         if CheckForMinGW32Sub(str, str) then strPathMingW32 = str
    14331433      end if
    14341434   end if
    14351435
    14361436   ' The tools location (post).
    1437    if (strPathMingW = "") And (g_blnInternalFirst = False) then
     1437   if (strPathMingW32 = "") And (g_blnInternalFirst = False) then
    14381438      str = g_strPathDev & "/win.x86/mingw32/v3.3.3"
    14391439      str2 = g_strPathDev & "/win.x86/w32api/v2.5"
    1440       if CheckForMingWSub(str, str2) then
    1441          strPathMingW = str
     1440      if CheckForMinGW32Sub(str, str2) then
     1441         strPathMingW32 = str
    14421442         strPathW32API = str2
    14431443      end if
     
    14451445
    14461446   ' Success?
    1447    if strPathMingW = "" then
    1448       if strOptMingw = "" then
    1449          MsgError "Can't locate a suitable MinGW installation. Try specify the path with " _
    1450             & "the --with-MinGW=<path> argument. If still no luck, consult the configure.log and the build requirements."
     1447   if strPathMingW32 = "" then
     1448      if g_strTargetArch = "amd64" then
     1449         MsgWarning "Can't locate a suitable MinGW32 installation, ignoring since we're targetting AMD64 and won't need it."
     1450      elseif strOptMinGW32 = "" then
     1451         MsgError "Can't locate a suitable MinGW32 installation. Try specify the path with " _
     1452            & "the --with-MinGW32=<path> argument. If still no luck, consult the configure.log and the build requirements."
    14511453      else
    1452          MsgError "Can't locate a suitable MinGW installation. Please consult the configure.log and the build requirements."
     1454         MsgError "Can't locate a suitable MinGW32 installation. Please consult the configure.log and the build requirements."
    14531455      end if
    14541456      exit sub
     
    14581460   ' Emit the config.
    14591461   '
    1460    strPathMingW = UnixSlashes(PathAbs(strPathMingW))
    1461    CfgPrint "PATH_TOOL_MINGW32     := " & strPathMingW
    1462    PrintResult "MinGW (GCC v" & g_strSubOutput & ")", strPathMingW
    1463    if (strPathMingW = strPathW32API) Or strPathW32API = "" then
     1462   strPathMingW32 = UnixSlashes(PathAbs(strPathMingW32))
     1463   CfgPrint "PATH_TOOL_MINGW32     := " & strPathMingW32
     1464   PrintResult "MinGW32 (GCC v" & g_strSubOutput & ")", strPathMingW32
     1465   if (strPathMingW32 = strPathW32API) Or strPathW32API = "" then
    14641466      CfgPrint "PATH_SDK_W32API       := $(PATH_TOOL_MINGW32)"
    14651467   else
     
    14711473''
    14721474' Checks if the specified path points to an usable MinGW or not.
    1473 function CheckForMingWSub(strPathMingW, strPathW32API)
     1475function CheckForMinGW32Sub(strPathMingW32, strPathW32API)
    14741476   g_strSubOutput = ""
    1475    if strPathW32API = "" then strPathW32API = strPathMingW
    1476    LogPrint "trying: strPathMingW="  &strPathMingW & " strPathW32API=" & strPathW32API
    1477 
    1478    if   LogFileExists(strPathMingW, "bin/mingw32-gcc.exe") _
    1479     And LogFileExists(strPathMingW, "bin/ld.exe") _
    1480     And LogFileExists(strPathMingW, "bin/objdump.exe") _
    1481     And LogFileExists(strPathMingW, "bin/dllwrap.exe") _
    1482     And LogFileExists(strPathMingW, "bin/as.exe") _
    1483     And LogFileExists(strPathMingW, "include/string.h") _
    1484     And LogFileExists(strPathMingW, "include/_mingw.h") _
    1485     And LogFileExists(strPathMingW, "lib/dllcrt1.o") _
    1486     And LogFileExists(strPathMingW, "lib/dllcrt2.o") _
    1487     And LogFileExists(strPathMingW, "lib/libmsvcrt.a") _
     1477   if strPathW32API = "" then strPathW32API = strPathMingW32
     1478   LogPrint "trying: strPathMingW32="  &strPathMingW32 & " strPathW32API=" & strPathW32API
     1479
     1480   if   LogFileExists(strPathMingW32, "bin/mingw32-gcc.exe") _
     1481    And LogFileExists(strPathMingW32, "bin/ld.exe") _
     1482    And LogFileExists(strPathMingW32, "bin/objdump.exe") _
     1483    And LogFileExists(strPathMingW32, "bin/dllwrap.exe") _
     1484    And LogFileExists(strPathMingW32, "bin/as.exe") _
     1485    And LogFileExists(strPathMingW32, "include/string.h") _
     1486    And LogFileExists(strPathMingW32, "include/_mingw.h") _
     1487    And LogFileExists(strPathMingW32, "lib/dllcrt1.o") _
     1488    And LogFileExists(strPathMingW32, "lib/dllcrt2.o") _
     1489    And LogFileExists(strPathMingW32, "lib/libmsvcrt.a") _
    14881490    _
    14891491    And LogFileExists(strPathW32API, "lib/libkernel32.a") _
    14901492    And LogFileExists(strPathW32API, "include/windows.h") _
    14911493      then
    1492       if Shell(DosSlashes(strPathMingW & "/bin/gcc.exe") & " --version", True) = 0 then
     1494      if Shell(DosSlashes(strPathMingW32 & "/bin/gcc.exe") & " --version", True) = 0 then
    14931495         dim offVer, iMajor, iMinor, iPatch, strVer
    14941496
     
    15111513         if strVer <> "" then
    15121514            if (iMajor = 3) And (iMinor = 3) then
    1513                CheckForMingWSub = True
     1515               CheckForMinGW32Sub = True
    15141516               g_strSubOutput = strVer
    15151517            else
    1516                LogPrint "MinGW version '" & iMajor & "." & iMinor & "." & iPatch & "' is not supported (or configure.vbs failed to parse it correctly)."
     1518               LogPrint "MinGW32 version '" & iMajor & "." & iMinor & "." & iPatch & "' is not supported (or configure.vbs failed to parse it correctly)."
     1519            end if
     1520         else
     1521            LogPrint "Couldn't locate the GCC version in the output!"
     1522         end if
     1523
     1524      else
     1525         LogPrint "Failed to run gcc.exe!"
     1526      end if
     1527   end if
     1528end function
     1529
     1530
     1531''
     1532' Checks for a MinGW-w64 suitable for building the recompiler.
     1533'
     1534sub CheckForMinGWw64(strOptMinGWw64)
     1535   dim strPathMingWw64, str
     1536   PrintHdr "MinGW-w64 GCC (unprefixed)"
     1537
     1538   '
     1539   ' Find the MinGW-w64 tools.
     1540   '
     1541   strPathMingWw64 = ""
     1542
     1543   ' The specified path.
     1544   if (strPathMingWw64 = "") And (strOptMinGWw64 <> "") then
     1545      if CheckForMinGWw64Sub(strOptMinGWw64) then
     1546         strPathMingWw64 = strOptMinGWw64
     1547      end if
     1548   end if
     1549
     1550   ' The tools location (first).
     1551   if (strPathMinGWw64 = "") And (g_blnInternalFirst = True) then
     1552      str = g_strPathDev & "/win.amd64/mingw-w64/r1"
     1553      if CheckForMinGWw64Sub(str) then
     1554         strPathMinGWw64 = str
     1555      end if
     1556   end if
     1557
     1558   ' See if there is any gcc around.
     1559   if strPathMinGWw64 = "" then
     1560      str = Which("x86_64-w64-mingw32-gcc.exe")
     1561      if (str <> "") then
     1562         str = PathParent(PathStripFilename(str))
     1563         if CheckForMinGWw64Sub(str) then strPathMinGWw64 = str
     1564      end if
     1565   end if
     1566
     1567   if strPathMinGWw64 = "" then
     1568      str = Which("gcc.exe")
     1569      if (str <> "") then
     1570         str = PathParent(PathStripFilename(str))
     1571         if CheckForMinGWw64Sub(str) then strPathMinGWw64 = str
     1572      end if
     1573   end if
     1574
     1575   ' The tools location (post).
     1576   if (strPathMinGWw64 = "") And (g_blnInternalFirst = False) then
     1577      str = g_strPathDev & "/win.amd64/mingw-w64/r1"
     1578      if CheckForMinGWw64Sub(str) then
     1579         strPathMinGWw64 = str
     1580      end if
     1581   end if
     1582
     1583   ' Success?
     1584   if strPathMinGWw64 = "" then
     1585      if g_strTargetArch = "x86" then
     1586         MsgWarning "Can't locate a suitable MinGW-w64 installation, ignoring since we're targetting x86 and won't need it."
     1587      elseif strOptMinGWw64 = "" then
     1588         MsgError "Can't locate a suitable MinGW-w64 installation. Try specify the path with " _
     1589            & "the --with-MinGW-w64=<path> argument. If still no luck, consult the configure.log and the build requirements."
     1590      else
     1591         MsgError "Can't locate a suitable MinGW-w64 installation. Please consult the configure.log and the build requirements."
     1592      end if
     1593      exit sub
     1594   end if
     1595
     1596   '
     1597   ' Emit the config.
     1598   '
     1599   strPathMinGWw64 = UnixSlashes(PathAbs(strPathMinGWw64))
     1600   CfgPrint "PATH_TOOL_MINGWW64    := " & strPathMinGWw64
     1601   PrintResult "MinGW-w64 (GCC v" & g_strSubOutput & ")", strPathMinGWw64
     1602end sub
     1603
     1604''
     1605' Checks if the specified path points to an usable MinGW-w64 or not.
     1606function CheckForMinGWw64Sub(strPathMinGWw64)
     1607   g_strSubOutput = ""
     1608   LogPrint "trying: strPathMinGWw64="  &strPathMinGWw64
     1609
     1610   if   LogFileExists(strPathMinGWw64, "bin/gcc.exe") _
     1611    And LogFileExists(strPathMinGWw64, "bin/ld.exe") _
     1612    And LogFileExists(strPathMinGWw64, "bin/objdump.exe") _
     1613    And LogFileExists(strPathMinGWw64, "bin/dllwrap.exe") _
     1614    And LogFileExists(strPathMinGWw64, "bin/dlltool.exe") _
     1615    And LogFileExists(strPathMinGWw64, "bin/as.exe") _
     1616    And LogFileExists(strPathMinGWw64, "include/bfd.h") _
     1617    And LogFileExists(strPathMinGWw64, "lib64/libgcc_s.a") _
     1618    And LogFileExists(strPathMinGWw64, "x86_64-w64-mingw32/lib/dllcrt1.o") _
     1619    And LogFileExists(strPathMinGWw64, "x86_64-w64-mingw32/lib/dllcrt2.o") _
     1620    And LogFileExists(strPathMinGWw64, "x86_64-w64-mingw32/lib/libmsvcrt.a") _
     1621    And LogFileExists(strPathMinGWw64, "x86_64-w64-mingw32/lib/libmsvcr100.a") _
     1622    And LogFileExists(strPathMinGWw64, "x86_64-w64-mingw32/include/_mingw.h") _
     1623    And LogFileExists(strPathMinGWw64, "x86_64-w64-mingw32/include/stdint.h") _
     1624    And LogFileExists(strPathMinGWw64, "x86_64-w64-mingw32/include/windows.h") _
     1625      then
     1626      if Shell(DosSlashes(strPathMinGWw64 & "/bin/gcc.exe") & " -dumpversion", True) = 0 then
     1627         dim offVer, iMajor, iMinor, iPatch, strVer
     1628
     1629         ' extract the version.
     1630         strVer = Trim(Replace(Replace(g_strShellOutput, vbCr, ""), vbLf, ""))
     1631         if   (Mid(strVer, 2, 1) = ".") _
     1632          And (Mid(strVer, 4, 1) = ".") then
     1633            iMajor = Int(Left(strVer, 1)) ' Is Int() the right thing here? I want atoi()!!!
     1634            iMinor = Int(Mid(strVer, 3, 1))
     1635            iPatch = Int(Mid(strVer, 5))
     1636         else
     1637            LogPrint "Malformed version: '" & strVer & "'"
     1638            strVer = ""
     1639         end if
     1640         if strVer <> "" then
     1641            if (iMajor = 4) And (iMinor >= 4) then
     1642               CheckForMinGWw64Sub = True
     1643               g_strSubOutput = strVer
     1644            else
     1645               LogPrint "MinGW-w64 version '" & iMajor & "." & iMinor & "." & iPatch & "' is not supported (or configure.vbs failed to parse it correctly)."
    15171646            end if
    15181647         else
     
    20122141   Print "  --with-kBuild=PATH    "
    20132142   Print "  --with-libSDL=PATH    "
    2014    Print "  --with-MinGW=PATH     "
     2143   Print "  --with-MinGW32=PATH   "
     2144   Print "  --with-MinGW-w64=PATH "
    20152145   Print "  --with-Qt4=PATH       "
    20162146   Print "  --with-SDK=PATH       "
     
    20472177   strOptkBuild = ""
    20482178   strOptlibSDL = ""
    2049    strOptMingW = ""
     2179   strOptMinGW32 = ""
     2180   strOptMinGWw64 = ""
    20502181   strOptQt4 = ""
    20512182   strOptSDK = ""
     
    20862217         case "--with-libsdl"
    20872218            strOptlibSDL = strPath
    2088          case "--with-mingw"
    2089             strOptMingW = strPath
     2219         case "--with-mingw32"
     2220            strOptMinGW32 = strPath
     2221         case "--with-mingw-w64"
     2222            strOptMinGWw64 = strPath
    20902223         case "--with-qt4"
    20912224            strOptQt4 = strPath
     
    21682301   CheckForPlatformSDK strOptSDK
    21692302   CheckForMidl
    2170    CheckForMingW strOptMingw, strOptW32API
     2303   CheckForMinGW32 strOptMinGW32, strOptW32API
     2304   CheckForMinGWw64 strOptMinGWw64
    21712305   CfgPrint "VBOX_WITH_OPEN_WATCOM := " '' @todo look for openwatcom 1.9+
    21722306   EnvPrint "set PATH=%PATH%;" & g_strPath& "/tools/win." & g_strTargetArch & "/bin;" '' @todo look for yasm
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette