Cross-compiling Mono's AOT tool for iOS on Mac

Source: Internet
Author: User
Tags emit

New Compile command:


#!/bin/bash
Build_mac_x64=1
Build_mac_i386=1
Build_armv7_android=0
Build_i386_ios_sim=0
Build_armv7_iphone=0
Build_armv7s_iphone=0
Build_aot_host_mac_target_armv7=0


Build_target=mono_target








ios_min_sdk=6.1
(
pwd= ' pwd '
Prefix=${pwd}/${build_target}












Extra_make_flags= "-j4"








If [$BUILD _mac_x64-eq 1]
Then




echo "##################"
echo "x64 for MAC"
echo "##################"
(
RM-RF ${prefix}/mac/x64


Make clean
./configure--prefix= "${prefix}/mac/x64"--enable-nls=no--host=x86_64-apple-darwin
Make ${extra_make_flags}
Make ${extra_make_flags} Install
)


echo "##################"
echo "x64 for MAC End"
echo "##################"
Fi


If [$BUILD _mac_i386-eq 1]
Then




echo "##################"
echo "I386 for MAC"
echo "##################"
(
RM-RF ${prefix}/mac/i386


Make clean
./configure--prefix= "${prefix}/mac/i386"--enable-nls=no--host=i386-apple-darwin
Make ${extra_make_flags}
Make ${extra_make_flags} Install
)


echo "##################"
echo "i386 for MAC End"
echo "##################"
Fi




If [$BUILD _aot_host_mac_target_armv7-eq 1]
Then


echo "##################"
echo "Aot host MAC target ARMv7"
echo "##################"
(
RM-RF ${prefix}/aot_host_mac_target_armv7


Make clean
./configure--prefix= "${prefix}/aot_host_mac_target_armv7"--enable-small-config=yes--with-ikvm-native=no-- With-sigaltstack=no--with-tls=pthread--without-mcs-docs--disable-mcs-build--enable-nls=no--enable-minimal= Profiler,logging,full_messages,reflection_emit,reflection_emit_save--host=x86_64-apple-darwin--target= Armv7-apple-darwin
Make ${extra_make_flags}
Make ${extra_make_flags} Install
)


echo "##################"
echo "Aot host MAC target armv7 end"
echo "##################"
Fi






If [$BUILD _armv7_android-eq 1]
Then




echo "##################"
echo "ARMv7 for Android"
echo "##################"
(
RM-RF ${prefix}/android/armv7




Make clean




Export ndk=/users/user/desktop/mono/android-ndk-r10e
# $NDK/build/tools/make-standalone-toolchain.sh--platform=android-19--install-dir=/users/user/desktop/mono/tmp/ My-android-toolchain--arch=arm
Export Path=/users/user/desktop/mono/tmp/my-android-toolchain/bin: $PATH
Export cc= "Arm-linux-androideabi-gcc-dplatform_android"
Export cxx=arm-linux-androideabi-g++
Export Ar=arm-linux-androideabi-ar
Export As=arm-linux-androideabi-as
Export Cpp=arm-linux-androideabi-cpp
Export LD=ARM-LINUX-ANDROIDEABI-LD
Export Ranlib=arm-linux-androideabi-ranlib
Export Strip=arm-linux-androideabi-strip
Export sysroot= $NDK/plarforms/android-19/arch-arm


./configure--prefix= "${prefix}/android/armv7"--host=armv7-linux-androideabi--enable-minimal=profiler,logging-- With-tls=pthread--with-monotouch=no--without-mcs-docs--with-sigaltstack=no--disable-mcs-build--enable-nls=no
Make ${extra_make_flags}
Make ${extra_make_flags} Install
)


echo "##################"
echo "ARMv7 for Android End"
echo "##################"
Fi














Xcodedir= ' Xcode-select--print-path '








ios_sdk=$ (Xcodebuild-showsdks | grep iphoneos | sort | head-n 1 | awk ' {print $NF} ')
sim_sdk=$ (Xcodebuild-showsdks | grep iphonesimulator | sort | head-n 1 | awk ' {print $NF} ')








Iphoneos_platform=${xcodedir}/platforms/iphoneos.platform
Iphoneos_sysroot=${iphoneos_platform}/developer/sdks/${ios_sdk}.sdk








Iphonesimulator_platform=${xcodedir}/platforms/iphonesimulator.platform
Iphonesimulator_sysroot=${iphonesimulator_platform}/developer/sdks/${sim_sdk}.sdk








Cc=clang
Cflags= "-o2-std=gnu99-dhost_ios"
Cxx=clang
Cxxflags= "${cflags}-stdlib=libc++"
Ldflags= "-stdlib=libc++"
libs= "-lc++-lc++abi"
cpp= "XCRUN-SDK Iphoneos cpp"
ar= "Xcrun-sdk iphoneos ar rcu"
cppflags= "${cflags}"








If [$BUILD _armv7_iphone-eq 1]
Then








echo "##################"
echo "ARMv7 for IPhone"
echo "##################"
(
RM-RF ${prefix}/armv7


Make clean
./configure--enable-small-config=yes--with-ikvm-native=no--with-sigaltstack=no--with-tls=pthread-- Without-mcs-docs--disable-mcs-build--enable-nls=no--enable-minimal=profiler,logging,full_messages,reflection_ Emit,reflection_emit_save--build=x86_64-apple-darwin--host=armv7-apple-darwin--prefix= "${PREFIX}/armv7" CC= Clang "Cflags=${cflags}-miphoneos-version-min=${ios_min_sdk}-arch armv7-isysroot ${iphoneos_sysroot}" "CXX=${CXX}" "Cxxflags=${cxxflags}-arch armv7-isysroot ${iphoneos_sysroot}" ldflags= "-arch Armv7-miphoneos-version-min=${ios_ MIN_SDK} ${ldflags} "" Libs=${libs} "
Make ${extra_make_flags}
Make ${extra_make_flags} Install
)


echo "##################"
echo "ARMv7 for IPhone End"
echo "##################"


Fi




If [$BUILD _armv7s_iphone-eq 1]
Then
echo "###################"
echo "Armv7s for IPhone"
echo "###################"
(
RM-RF ${prefix}/armv7s
Make clean
./configure--enable-small-config=yes--with-ikvm-native=no--with-sigaltstack=no--with-tls=pthread-- Without-mcs-docs--disable-mcs-build--enable-nls=no--enable-minimal=profiler,logging,full_messages,reflection_ Emit,reflection_emit_save--build=x86_64-apple-darwin--host=armv7s-apple-darwin--prefix= "${PREFIX}/armv7s" "CC=$ {CC} "" Cflags=${cflags}-miphoneos-version-min=${ios_min_sdk}-arch armv7s-isysroot ${iphoneos_sysroot} "" CXX=${CXX} "" Cxxflags=${cxxflags}-arch armv7s-isysroot ${iphoneos_sysroot} "ldflags="-arch Armv7s-miphoneos-version-min=${ios _MIN_SDK} ${ldflags} "" Libs=${libs} "
Make ${extra_make_flags}
Make ${extra_make_flags} Install
)


echo "###################"
echo "armv7s for IPhone End"
echo "###################"
Fi








If [$BUILD _i386_ios_sim-eq 1]
Then
echo "###########################"
echo "i386 for IPhone Simulator"
echo "###########################"
(
RM-RF ${prefix}/sim
Make clean
./configure--enable-small-config=yes--with-ikvm-native=no--with-sigaltstack=no--with-tls=pthread-- Without-mcs-docs--disable-mcs-build--enable-nls=no--enable-minimal=profiler,logging,full_messages,reflection_ Emit,reflection_emit_save--build=x86_64-apple-darwin--host=i386-apple-darwin--prefix= "${PREFIX}/sim" "CC=${CC}" "Cflags=${cflags}-miphoneos-version-min=${ios_min_sdk}-arch i386-isysroot ${iphonesimulator_sysroot}" "CXX=${CXX} "" Cxxflags=${cxxflags}-arch i386-isysroot ${iphonesimulator_sysroot} "ldflags="-arch i386-miphoneos-version-min=${ IOS_MIN_SDK} ${ldflags} "" Libs=${libs} "
Make ${extra_make_flags}
Make ${extra_make_flags} Install
)
echo "###########################"
echo "i386 for IPhone Simulator end"
echo "###########################"
Fi








) 2>&1
#) >build.log 2>&1








echo "Done"

Cross-compiling Mono's AOT tool for iOS on Mac

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.