XiZi's Blog
Build Mingw64 on MACOSX
主要参照:http://sourceforge.net/apps/trac/mingw-w64/wiki/mingw-w64-howto-build 给出的过程。
这里我们需要注意的几处:
0、依赖
isl,cloog,使用brew安装,这里如果你升级过这些模块或系统,可能会导致模块不兼容,这可以吧这些模块重新安装一下确保兼容。
1 2 3 4 | brew reinstall isl brew link --overwrite isl #reinstall 可能会提示 brew reinstall cloog brew link --overwrite cloog #reinstall 可能会提示 |
1、安装“mingw64 headers ”
进入“mingw-w64-$version/mingw-w64-headers”目录下的,创建build文件夹,进入build文件夹进行configure,make,make install。
1 2 3 | .. /configure --build=x86_64-pc-mingw32 --host=x86_64-pc-mingw32 --prefix= /opt/mingw64/x86_64-pc-mingw32 make make install |
2、进行完整的gcc编译前,把/path/to/mingw64/x86_64-pc-mingw32/lib下面的内容移动到/path/to/mingw64/lib里面,然后创建链接链接到上层lib文件夹,然后在进行编译,否则可能会出现找不到“crtbegin.o crtend.o dllcrt2.o”类似的错误。
1 2 3 4 5 | cd /path/to/mingw64/lib mv .. /x86_64-pc-mingw32/lib/ * ./ cd .. /x86_64-pc-mingw32 rm -r lib ln -s .. /lib ./ |
修改Mac安装盘,直接运行OSInstall.mpkg安装系统,到第二分区。
1、主要修改OSInstall.mpkg和BaseSystemResources.pkg两个文件(位于目录:System/Installation/Packages下面)。
2、修改OSInstall.mpkg,主要取消一些安装包没有但是在Distribution文件里面默认配置了,所以安装的时候提示出错。步骤如下
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 | # 1. 创建OSInstall文件夹,并解压mpkg文件. 在这之前可能需要sudo获取root权限。 mkdir OSInstall cd OSInstall xar -x -f .. /OSInstall .mpkg # 2. 用你喜欢的文本编辑器编辑Distribution文件,主要修改4个地方 ####(1)删除 eraseOptionAvailable="true" 是目标可以安装在MBR分区 @@ -1,6 +1,6 @@ <?xml version= "1.0" standalone= "yes" ?> <installer-gui-script minSpecVersion= "1" > - <options eraseOptionAvailable= "true" hostArchitectures= "i386" allow-external-scripts= "yes" /> + <options hostArchitectures= "i386" allow-external-scripts= "yes" /> <title>MacOSX_Title< /title > <license file = "License.rtf" /> <conclusion file = "Conclusion.rtfd" /> #### (2) 修改isSupportedPlatform函数直接返回true @@ -41,23 +41,7 @@ function isSupportedPlatform(){ - if ( isVirtualMachine() ){ - return true ; - } - - var platformSupportValues=[ "Mac-F2268DC8" , "Mac-F22C86C8" , "Mac-F22587C8" , "Mac-F2218FA9" , "Mac-F2218EA9" , "Mac-F42D86A9" , "Mac-F22C8AC8" , "Mac-F22586C8" , "Mac-942B59F58194171B" , "Mac-F226BEC8" , "Mac-F4218FC8" , "Mac-942459F5819B171B" , "Mac-7BA5B2794B2CDB12" , "Mac-F4218EC8" , "Mac-F2208EC8" , "Mac-F22C89C8" , "Mac-F22587A1" , "Mac-F221DCC8" , "Mac-F42388C8" , "Mac-F223BEC8" , "Mac-F4238CC8" , "Mac-F222BEC8" , "Mac-F227BEC8" , "Mac-F4208AC8" , "Mac-F22788A9" , "Mac-F4238BC8" , "Mac-F221BEC8" , "Mac-C08A6BB70A942AC2" , "Mac-8ED6AF5B48C039E1" , "Mac-F2238AC8" , "Mac-F4208EAA" , "Mac-F22788C8" , "Mac-F2268EC8" , "Mac-F2218EC8" , "Mac-F22589C8" , "Mac-F4228EC8" , "Mac-F22788AA" , "Mac-F42C86C8" , "Mac-F4208CA9" , "Mac-942C5DF58193131B" , "Mac-F2238BAE" , "Mac-F42289C8" , "Mac-F2268CC8" , "Mac-F4208DC8" , "Mac-F2218FC8" , "Mac-742912EFDBEE19B3" , "Mac-F4208DA9" , "Mac-F42D89C8" , "Mac-F4208CAA" , "Mac-F42D89A9" , "Mac-F2268AC8" , "Mac-F42C89C8" , "Mac-942452F5819B1C1B" , "Mac-F42786A9" , "Mac-F42D88C8" , "Mac-F42187C8" , "Mac-94245B3640C91C81" , "Mac-F42D86C8" , "Mac-4BC72D62AD45599E" , "Mac-F2268DAE" , "Mac-F42C8CC8" , "Mac-F42C88C8" , "Mac-94245A3940C91C80" , "Mac-F42386C8" , "Mac-942B5BF58194151B" , "Mac-F42189C8" ]; - var boardID = system.ioregistry.fromPath( 'IOService:/' )[ 'board-id' ]; - - if ( !boardID || platformSupportValues.length ==0 ) { - return false - } - for ( var i = 0; i < platformSupportValues.length; i++ ){ - if ( boardID == platformSupportValues[i] ){ - return true ; - } - } - - return false ; + return true ; } ####(3)检查是否为Server版本系统 @@ -170,19 +154,9 @@ return false ; } - // Media Snag Boot - } else if (system. env .__OSINSTALL_ENVIRONMENT == '1' && system.files.fileExistsAtPath( "/System/Installation/Packages/OSInstall.mpkg" )) { - - // Only allow install on server volumes if Server.app is installed - if (! system.files.bundleAtPath(my.target.mountpoint + "/Applications/Server.app" )) { - - my.result.message = system.localizedString( 'VC_NeedServerApp_message' ); - my.result. type = 'Fatal' ; - return false ; - } // Recovery HD - } else if (system. env .__OSINSTALL_ENVIRONMENT == '1' && ! system.files.fileExistsAtPath( "/System/Installation/Packages/OSInstall.mpkg" )) { + } else if (! system.files.fileExistsAtPath( "/System/Installation/Packages/OSInstall.mpkg" )) { // Block Server volumes my.result.message = system.localizedString( 'VC_CannotUpgradeServerRecovery_message' ); ####(4)去掉没有的语言包制定 @@ -596,16 +543,6 @@ <pkg-ref id = "com.apple.MacOSX.lang.tr" auth= "root" >Turkish.pkg< /pkg-ref > <pkg-ref id = "com.apple.MacOSX.lang.cs" auth= "root" >Czech.pkg< /pkg-ref > <pkg-ref id = "com.apple.pkg.ServerEssentials" auth= "root" >ServerEssentials.pkg< /pkg-ref > - <pkg-ref id = "com.apple.MacOSX.lang.th" auth= "root" >Thai.pkg< /pkg-ref > - <pkg-ref id = "com.apple.MacOSX.lang.ca" auth= "root" >Catalan.pkg< /pkg-ref > - <pkg-ref id = "com.apple.MacOSX.lang.hr" auth= "root" >Croatian.pkg< /pkg-ref > - <pkg-ref id = "com.apple.MacOSX.lang.el" auth= "root" >Greek.pkg< /pkg-ref > - <pkg-ref id = "com.apple.MacOSX.lang.he" auth= "root" >Hebrew.pkg< /pkg-ref > - <pkg-ref id = "com.apple.MacOSX.lang.ro" auth= "root" >Romanian.pkg< /pkg-ref > - <pkg-ref id = "com.apple.MacOSX.lang.sk" auth= "root" >Slovak.pkg< /pkg-ref > - <pkg-ref id = "com.apple.MacOSX.lang.uk" auth= "root" >Ukrainian.pkg< /pkg-ref > - <pkg-ref id = "com.apple.mpkg.OSInstall" auth= "root" version= "10.7.0" >OSInstall.mpkg< /pkg-ref > - <system-image id = "com.apple.dmg.MacOSX" >BaseSystem.dmg< /system-image > <pkg-ref id = "com.apple.MacOSX.lang.ar" installKBytes= "50124" version= "10.7.0.1.1.1306847324" /> <pkg-ref id = "com.apple.MacOSX.lang.ca" installKBytes= "75279" version= "10.7.0.1.1.1306847324" /> <pkg-ref id = "com.apple.MacOSX.lang.cs" installKBytes= "42768" version= "10.7.0.1.1.1306847324" /> #3. 重新打包OSInstall.mpkg xar -c -f .. /OSInstall .mpkg * |
3. 修改BaseSystemResources.pkg
1 2 3 4 5 6 7 8 | # 1. 创建BaseSystemResources文件夹,并解压mpkg文件. 在这之前可能需要sudo获取root权限。 mkdir BaseSystemResources cd BaseSystemResources xar -x -f .. /BaseSystemResources .pkg # 2. 创建Payload文件 touch Payload # 3. 重新打包 xar -c -f .. /BaseSystemResources .pkg * |