jl4rb 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2284c017e95791b1179e1f0a61b46520f193a0057b9ce968d46071126408b219
4
- data.tar.gz: 7c5223125d3a8bd4ac49e10db04e7071050b870e84278dbd835c6b1f5c29bef4
3
+ metadata.gz: 5c7ae193c99972539639a96d7964b652f4d778c4003566549ad28acff8d58fa1
4
+ data.tar.gz: c588912e8ad02fda35f7eb0034cdf7e5d3d220385a991824bd594ac8bf67244b
5
5
  SHA512:
6
- metadata.gz: 811939ca02ebe88ffc9eb91836a28872ffec2191668ca82179e5c0a2d7c3620e0a9637b8bf187e703694e682f8db7f92f0f6f9139a44c5a911bb9335f9f1f762
7
- data.tar.gz: 6fd70f99e98ddae1ad68239cebfc12b5eae5c5c6111c3a489d00d2cdf9f96cd37cd252924e6c9555748ca4cebba0a120c51e98e92198959f265c09c90f15be08
6
+ metadata.gz: b9f41f2debc68026e427d292cade9b08d70f44b3702f8885728f0367ba4478a65dec3177f7b3577c6de0fbbacea83f3e9e80f8bc005303d82b8a3a7e4ef0a329
7
+ data.tar.gz: 9c496f95518a6ea625b41ae22a60743a660f8fa760fc964a8fb0862a3aa71f7de0c33916e2d38c32f1304bdd9ddb9a68665dad238947dae5a3571b1e76377685
@@ -1,37 +1,23 @@
1
1
  require "mkmf"
2
- require 'fileutils' #if RUBY_VERSION < "1.9"
3
-
2
+ require 'fileutils'
4
3
 
5
4
  $prefix_include,$prefix_lib=[],[]
6
- # if RUBY_PLATFORM =~ /linux/
7
- # $prefix_include << "/usr/include/"+RUBY_PLATFORM+"/julia" if File.exists? "/usr/include/"+RUBY_PLATFORM+"/julia"
8
- # $prefix_include << "/usr/include/julia" if File.exists? "/usr/include/julia"
9
-
10
- # $prefix_lib << "/usr/lib/"+RUBY_PLATFORM+"/julia" if File.exists? "/usr/lib/"+RUBY_PLATFORM+"/julia"
11
- # else
12
- #$prefix=ENV["JLAPI_HOME"] || File.join(ENV["HOME"],".jlapi/julia") || ENV["JULIA_HOME"]
13
- $prefix=ENV["JULIA_DIR"]
14
- #p $prefix
15
- [$prefix+"/include/julia",$prefix+"/usr/include",$prefix+"/src",$prefix+"/src/support"].each do |incl|
16
- $prefix_include << incl if File.exists? incl
17
- end
18
-
19
- ([$prefix+"/lib/julia",$prefix+"/usr/lib",$prefix+"/lib"]+(RUBY_PLATFORM=~/(?:mingw|msys)/ ? [$prefix+"/bin"] : [])).each do |lib|
20
- $prefix_lib << lib if File.exists? lib
21
- end
22
- # end
5
+ $prefix= File.dirname(`julia -e 'print(Sys.BINDIR)'`)
23
6
 
24
- def jl4rb_makefile(incs,libs)
25
- #$CFLAGS = "-I"+inc+" -I."
26
- # $CFLAGS = (enable_config("julia-release") ? "-DWITH_JULIA_RELEASE " : "")+ "-I"+inc+" -I."
27
- # $LDFLAGS = " -Wl,-rpath,"+lib+" -L"+lib if lib
28
- # $libs = (enable_config("julia-release") ? " -ljulia-release" : " -ljulia-api" )
7
+ [$prefix+"/include/julia",$prefix+"/usr/include",$prefix+"/src",$prefix+"/src/support"].each do |incl|
8
+ $prefix_include << incl if File.exists? incl
9
+ end
29
10
 
30
- ## TODO: utiliser julia-config
11
+ ([$prefix+"/lib/julia",$prefix+"/usr/lib",$prefix+"/lib"]+(RUBY_PLATFORM=~/(?:mingw|msys)/ ? [$prefix+"/bin"] : [])).each do |lib|
12
+ $prefix_lib << lib if File.exists? lib
13
+ end
14
+
15
+ def jl4rb_makefile(incs,libs)
31
16
 
32
- $CFLAGS = "-DJULIA_ENABLE_THREADING=1 -fPIC " + incs.map{|inc| "-I"+inc}.join(" ")+" -I."
33
- $LDFLAGS = " "+libs.map{|lib| "-Wl,-rpath,'"+lib+"' -L'"+lib+"'"}.join(" ") if libs
34
- $libs = " -ljulia"
17
+ jl_share=`julia -e 'print(joinpath(Sys.BINDIR, Base.DATAROOTDIR, "julia"))'`
18
+ $CFLAGS =`julia #{jl_share}/julia-config.jl --cflags`
19
+ $LDFLAGS =`julia #{jl_share}/julia-config.jl --ldflags`
20
+ $libs =`julia #{jl_share}/julia-config.jl --ldlibs`
35
21
 
36
22
 
37
23
  header = nil
@@ -9,8 +9,6 @@
9
9
  #include <string.h>
10
10
  #include <math.h>
11
11
 
12
- //JULIA_DEFINE_FAST_TLS()
13
-
14
12
  //#define WITH_JULIA_RELEASE
15
13
 
16
14
  //#ifdef WITH_JULIA_RELEASE
@@ -29,41 +27,9 @@
29
27
  /************* INIT *********************/
30
28
 
31
29
 
32
- VALUE Julia_init(VALUE obj, VALUE args)
30
+ VALUE Julia_init()
33
31
  {
34
- char **argv,*julia_home_dir;
35
- int i,argc;
36
- VALUE tmp;
37
-
38
- argc=RARRAY_LEN(args) + 1;
39
- tmp=rb_ary_entry(args,0);
40
- julia_home_dir=StringValuePtr(tmp);
41
- //printf("First initialization with julia_home_dir=%s\n",julia_home_dir);
42
- // printf("copy stacks ");
43
- // #ifdef COPY_STACKS
44
- // printf("defined \n");
45
- // #else
46
- // printf("undefined \n");
47
- // #endif
48
- // printf("JL_SET_STACK_BASE ");
49
- // #ifdef JL_SET_STACK_BASE
50
- // printf("defined \n");
51
- // #else
52
- // printf("undefined \n");
53
- // #endif
54
- //#ifdef WITH_JULIA_RELEASE
55
- // if(strcmp(julia_home_dir,"")==0) {
56
- // jl_init(); //(NULL);
57
- // //JL_SET_STACK_BASE;
58
- // } else {
59
- jl_init(); //(julia_home_dir);
60
- //julia_init(JL_IMAGE_JULIA_HOME);
61
- // //JL_SET_STACK_BASE;
62
- // }
63
- //#else
64
- // jlapi_init(julia_home_dir,mode);
65
- //#endif
66
-
32
+ jl_init();
67
33
  return Qtrue;
68
34
  }
69
35
 
@@ -535,7 +501,7 @@ Init_jl4rb()
535
501
 
536
502
  mJulia = rb_define_module("Julia");
537
503
 
538
- rb_define_module_function(mJulia, "initJL", Julia_init, 1);
504
+ rb_define_module_function(mJulia, "initJL", Julia_init, 0);
539
505
 
540
506
  rb_define_module_function(mJulia, "exitJL", Julia_exit, 1);
541
507
 
@@ -2,7 +2,7 @@ require 'rubygems'
2
2
  require 'rubygems/package_task'
3
3
 
4
4
  PKG_NAME='jl4rb'
5
- PKG_VERSION='0.2.0'
5
+ PKG_VERSION='0.2.1'
6
6
  PKG_FILES=FileList[
7
7
  'Rakefile','jl4rb.gemspec',
8
8
  'ext/jl4rb/*.c',
@@ -1,11 +1,8 @@
1
1
  module Julia
2
2
 
3
- def Julia.init(args={})
3
+ def Julia.init
4
4
  unless Julia.alive?
5
- args={:img=>File.join(ENV["JULIA_DIR"],"lib")}.merge(args) if ENV["JULIA_DIR"]
6
- args={:img=>ENV["JULIA_IMG_DIR"]}.merge(args) if ENV["JULIA_IMG_DIR"]
7
- #p [:julia_init,args,ENV]
8
- @@initJL=Julia.initJL([args[:img]])
5
+ @@initJL=Julia.initJL
9
6
  end
10
7
  end
11
8
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jl4rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - CQLS