Skip to content

Commit

Permalink
Unzip native libs duirng the build.
Browse files Browse the repository at this point in the history
So that they could be properly used when JRuby
is being invoked right from the repository.

Before this commit, we were unpacking the native libs
only during the 'dist' target. So, if JRuby was used right
from the repo directly it didn't see the libs and extracted them
every time from the jars during the startup.

Use 'ant clean-all' to remove those extracted libs, if needed.
  • Loading branch information
vvs committed Dec 24, 2009
1 parent f115371 commit 4e53125
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 16 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ build.properties
target
dist
lib/jruby*.jar
lib/native
lib/ruby/gems/1.8/source_cache
lib/ruby/gems/1.8/doc
lib/ruby/gems/1.8/gems
Expand Down
49 changes: 33 additions & 16 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@
<property name="spec.jvm.model.option" value="-T -J${run.jvm.model}"/>
<property name="rdoc.archive" value="docs/rdocs.tar.gz"/>
<uptodate property="docsNotNeeded" srcfile="${rdoc.archive}" targetfile="${basedir}/share/ri/1.8/system/created.rid"/>
<uptodate property="native-libs-uptodate" targetfile="${lib.dir}/native/libs.OK">
<srcfiles dir= "build_lib" includes="jffi-*.jar"/>
</uptodate>
</target>

<target name="extract-rdocs" depends="init" unless="docsNotNeeded">
Expand Down Expand Up @@ -277,7 +280,12 @@
</java>
</target>

<target name="jar-jruby" depends="generate-method-classes, generate-unsafe" unless="jar-up-to-date">
<target name="unzip-native-libs" unless="native-libs-uptodate">
<unzip-native-libs destination.dir="${lib.dir}/native"/>
<echo file="${lib.dir}/native/libs.OK"/>
</target>

<target name="jar-jruby" depends="generate-method-classes, generate-unsafe, unzip-native-libs" unless="jar-up-to-date">
<antcall target="_update_scm_revision_"/>

<jar destfile="${lib.dir}/jruby.jar" compress="true" index="true">
Expand Down Expand Up @@ -1327,6 +1335,28 @@
</sequential>
</macrodef>

<macrodef name="unzip-native-libs">
<attribute name="destination.dir"/>
<sequential>
<mkdir dir="@{destination.dir}"/>
<unzip dest="@{destination.dir}">
<fileset dir="build_lib">
<include name="jffi-*.jar"/>
</fileset>
<patternset>
<include name="**/libjffi-*.so"/>
<include name="**/libjffi-*.jnilib"/>
<include name="**/jffi-*.dll"/>
</patternset>
<mapper>
<filtermapper>
<replacestring from="jni/" to="./"/>
</filtermapper>
</mapper>
</unzip>
</sequential>
</macrodef>

<target name="apidocs" depends="prepare"
description="Creates the Java API docs">
<javadoc destdir="${api.docs.dir}" author="true" version="true" use="true"
Expand Down Expand Up @@ -1423,21 +1453,7 @@
</fileset>
</copy>
<mkdir dir="${dist.stage.bin.dir}/lib/native"/>
<unzip dest="${dist.stage.bin.dir}/lib/native">
<fileset dir="build_lib">
<include name="jffi-*.jar"/>
</fileset>
<patternset>
<include name="**/libjffi-*.so"/>
<include name="**/libjffi-*.jnilib"/>
<include name="**/jffi-*.dll"/>
</patternset>
<mapper>
<filtermapper>
<replacestring from="jni/" to="./"/>
</filtermapper>
</mapper>
</unzip>
<unzip-native-libs destination.dir="${dist.stage.bin.dir}/lib/native"/>
<fixEOLs dist-stage-dir="${dist.stage.bin.dir}"/>
<antcall target="install-gems">
<param name="jruby.home" value="${dist.stage.bin.dir}"/>
Expand Down Expand Up @@ -1591,6 +1607,7 @@

<target name="clean-all" depends="clean, clear-specs, dist-clean" description="Cleans everything, including dist files and specs">
<delete dir="${base.dir}/build.eclipse"/>
<delete dir="${base.dir}/lib/native"/>
</target>

<property name="nailgun.home" value="${basedir}/tool/nailgun"/>
Expand Down

0 comments on commit 4e53125

Please sign in to comment.