investing.com

수요일, 5월 18, 2011

[Beta] 1.맥(Mac) 에서 안드로이드(android) Build(빌드) 하기 - 개발환경 셋업

안드로이드 개발 하시는 분들은 리눅스의 다소 부족한 개발 환경 덕에 윈도우와 병행해서 개발 하는 경우가 많다. 하지만, 우리에게는 화려한 Mac 이 있지 아니한가~

얼마전에 안드로이드 사이트에서 Mac 개발 환경 설정에 대한 부분이 공식적으로 올라왔으니, 맥 사용자 들도 이제 안드로이드를 개발 할 수 있게 되었다.

안드로이드 소스 사이트에 일부 틀린 부분이 있어서, 그쪽 사이트를 정정하려면 시간이 소요될 듯 해서, 여기다가 정리해 본다.

그래서 제목도 [Beta] 이니 정리 완료 되면, Beta 를 떼도록 하겠다.

http://source.android.com/source/initializing.html

본 문서는 Mac intel 64 bit 탑재된 맥북과 64bit OS 인 Snow Leopard (10.6 ~) 에서 확인 해 본 내용이다.



Initializing a Build Environment



Setting up a Mac OS X build environment


1. Creating a case sensitive disk image  (작업할 공간 준비)


대소문자 구별이 가능한 파일 시스템이 필요한다. 
별도의 하드 디스크 공간이 있는 경우는 그 부분을 다시 포멧해서 사용하면 되고, 일반적인 경우라면 맥에서 지원되는 디스크 이미지 파일을 만들어서 Mount 해서 사용하면 된다.

방법은

"유틸리티" 폴더 안의 "디스크 유틸리티"를 실행하여 "새로운 이미지"를 만든다. 일단 크기는 12G 정도로 하면 전체를 빌드하는데 문제가 없다. 이미지의 이름과 저장될 폴더를 선택하고, 하단의 포멧에서 "Mac OS 확장(대소문자 구분,저널링)" 을 선택해서 이미지를 생성한다.

This will create a .dmg file which, once mounted, acts as a drive with the required formatting for Android development. For a disk image named "android.dmg" stored in your home directory, you can add the following to your ~/.bash_profile to mount the image when you execute "mountAndroid":
# mount the android file image
function mountAndroid () 
{ hdiutil attach ~/android.dmg-mountpoint /Volumes/android; }
Once mounted, you'll do all your work in the "android" volume. You can eject it (unmount it) just like you would with an external drive.

2. Installing required packages (필요한 SW 패키지 설치)







  • Install XCode from the Apple developer site. We recommend version 3.0 or newer. If you are not already registered as an Apple developer, you will have to create an Apple ID in order to download.







  • Install MacPorts from macports.org.
    주의:   /opt/local/bin 디렉토리가  /usr/bin 앞에 오도록 해야 한다. 
    export PATH=/opt/local/bin:$PATH
    
     ~/.bash_profile. 파일에  에디터를 열어서 위의 라인을 추가 한다.






  • Get make, git, and GPG packages from MacPorts:
    $ POSIXLY_CORRECT=1 sudo port install gmake libsdl git-core gnupg
    
    If using Mac OS 10.4, also install bison:
    $ POSIXLY_CORRECT=1 sudo port install bison





  • Reverting from make 3.82

    There is a bug in gmake 3.82 that prevents android from building. You can install version 3.81 using MacPorts by taking the following steps:
    • Edit /opt/local/etc/macports/sources.conf and a line that says
      file:///Users/Shared/dports
      
      above the rsync line. Then create this directory:
      $ mkdir /Users/Shared/dports
      
    • In the new dports directory, run
      $ svn co --revision 50980 http://svn.macports.org/repository/macports/trunk/dports/devel/gmake/ devel/gmake/
      
    • Create a port index for your new local repository:
      $ portindex /Users/Shared/dports
      
    • Finally, install the old version of gmake with
      $ sudo port install gmake @3.81
      

    Setting a file descriptor limit

    On MacOS the default limit on the number of simultaneous file descriptors open is too low and a highly parallel build process may exceed this limit.
    To increase the cap, add the following lines to your ~/.bash_profile:
    # set the number of open files to be 1024
    ulimit -S -n 1024
    



    댓글 없음: