File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -8,7 +8,32 @@ module Mkmf
88    # @param target [String] 
99    # @param srcprefix [String,nil] 
1010    def  create_go_makefile ( target ,  srcprefix  =  nil ) 
11+       find_executable ( "go" ) 
12+ 
13+       # rubocop:disable Style/GlobalVars 
14+       $objs =  [ ] 
15+       def  $objs. empty? ;  false ;  end 
16+       # rubocop:enable Style/GlobalVars 
17+ 
1118      create_makefile ( target ,  srcprefix ) 
19+ 
20+       case  `#{ CONFIG [ "CC" ] }   --version`  # rubocop:disable Lint/LiteralAsCondition 
21+       when  /Free Software Foundation/ 
22+         ldflags  =  "-Wl,--unresolved-symbols=ignore-all" 
23+       when  /clang/ 
24+         ldflags  =  "-undefined dynamic_lookup" 
25+       end 
26+ 
27+       current_dir  =  File . expand_path ( "." ) 
28+ 
29+       File . open ( "Makefile" ,  "a" )  do  |f |
30+         f . write  <<~MAKEFILE . gsub ( /^ {8}/ ,  "\t " ) 
31+           $(DLLIB): Makefile $(srcdir)/*.go 
32+                   cd $(srcdir); \  
33+                    CGO_CFLAGS='$(INCFLAGS)' CGO_LDFLAGS='#{ ldflags }  ' \ 
34+                      go build -p 4 -buildmode=c-shared -o #{ current_dir }  /$(DLLIB)
35+         MAKEFILE 
36+       end 
1237    end 
1338  end 
1439end 
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments