在Solaris10x86上编译eclipse3.1

可能受到IBM方面立场的影响, eclipse的官方发布版本中一直不包括Solaris/x86版本, 而这一个操作系统,一个开发平台又都是非常有价值的产品. 我以前自己通过eclipse的source build创建solaris/x86版本时一直遵循eclipse生成移植版的相关说明, 但步骤繁琐, 实在劳神费心.

随着eclipse3.1版本的发布,我决定升级自己Solaris/x86工作站上的eclipse, 在编译过程中突然想到了一个新的方法,大大简化了编译步骤,虽然对于eclipse来说修改了它的很多源代码目录和文件,使改后的源代码不能再用来创建Solaris/sparc版本,但对和我一样只是把eclipse作为工具使用而不是去开发它的人来说是很合适的.

操作过程如下:

 

$ JAVA_HOME=/usr/j2se; export JAVA_HOME
$ ANT_HOME=/home/compl/sfw/apache-ant-1.6.5; export ANT_HOME
$ PATH=$ANT_HOME/bin:$PATH; export PATH
$ mkdir -p ~/farm/eclipse-src
$ cd ~/farm
$ vi regexrename
-----start create script regexrename-----
-enter the following content:
 #!/bin/sh
 echo Renaming $1 to `echo $1 | sed $2`
 mv "$1" "`echo $1 | sed $2`"
-save and quit vi
-----end create script regexrename-----
$ chmod +x regexrename
$ vi regexreplace
-----start create script regexreplace-----
-enter the following content:
#!/bin/sh
 echo Replacing file $1...
 mv "$1" "$1.replaced"
 sed "$2" "$1.replaced" > "$1"
-save and quit vi
-----end create script regexreplace-----
$ chmod +x regexreplace
$ cd eclipse-src
$ unzip ~/Softwares/java/eclipse-sourceBuild-srcIncluded-3.1.zip
$ vi ./build
-----start modify script ./build-----
-change line:
 export ANT_OPTS=-Xmx1000M
-to
 ANT_OPTS=-Xmx1000M; export ANT_OPTS
-add a blank line at end of file, to force sed to realize the last line-----
-----end modify script ./build-----

-----now replace all sparc with i386 in directory and file names,

-----don't change i386 to x86, although x86 seems better follow eclipse src naming conventions,

-----or you have to perform some extra modifications on some scripts to correct x86 to i386,

-----like the awt lib path, that is $JAVA_HOME/jre/lib/sparc on sun machines and

-----$JAVA_HOME/jre/lib/i386 on intel PCs, NOT $JAVA_HOME/jre/lib/x86-----
$ find ./ -name \*sparc\* -exec ../regexrename "{}" 's/sparc/i386/g' \;
Renaming ./plugins/org.eclipse.platform.source.solaris.gtk.sparc to ./plugins/org.eclipse.platform.source.solaris.gtk.i386
find: stat() error ./plugins/org.eclipse.platform.source.solaris.gtk.sparc/fragment.xml: No such file or directory
find: stat() error ./plugins/org.eclipse.platform.source.solaris.gtk.sparc/META-INF: No such file or directory
find: stat() error ./plugins/org.eclipse.platform.source.solaris.gtk.sparc/build.properties: No such file or directory
find: stat() error ./plugins/org.eclipse.platform.source.solaris.gtk.sparc/about.html: No such file or directory
Renaming ./plugins/org.eclipse.rcp.source.solaris.gtk.sparc to ./plugins/org.eclipse.rcp.source.solaris.gtk.i386
find: stat() error ./plugins/org.eclipse.rcp.source.solaris.gtk.sparc/build.xml: No such file or directory
      .......
      .......
      .......
Renaming ./assemble.org.eclipse.sdk.solaris.gtk.sparc.xml.replaced to ./assemble.org.eclipse.sdk.solaris.gtk.i386.xml.replaced
-----Regarding the errors above, re-run the command to make sure-----

$ find ./ -name \*sparc\* -exec ../regexrename "{}" 's/sparc/i386/g' \;
$

-----now replace all sparc inside all revelant text files with i386-----
$ find ./ -type f \( -name \*.xml -o -name \*.properties -o -name \*.sh -o -name build \) -exec fgrep -s sparc "{}" \; -exec ../regexreplace "{}" 's/sparc/i386/g' \;
Replacing file ./build...
Replacing file ./plugins/org.eclipse.ui.cheatsheets/build.xml...
      .......
      .......
      .......
Replacing file ./assemble.org.eclipse.sdk.all.xml...
$

-----Perform a normal build-----
$ sh ./build -os solaris -ws gtk -arch i386 -compilelibs
      .......
      .......
      .......
BUILD SUCCESSFUL
Total time: 17 minutes 45 seconds
-----eclipse/eclipse seems remain the one for SPARC arch, update it manually-----

$ cp launchertmp/eclipse eclipse/
-----test run the compiled binary-----

$ eclipse/eclipse
-----eclipse 3.1 should start-----

 

-----Finally, be careful if you want to keep or distribute result/solaris-gtk-i386-sdk.zip,

-----eclipse/eclipse inside it remains the one for SPARC arch, you may want to

-----update it first.-----

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值