forked from rhomobile/rhodes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
extconf.rb
51 lines (42 loc) · 2.1 KB
/
extconf.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
require 'fileutils'
include FileUtils
mv File.dirname(__FILE__) +"/../rakefile.rb", File.dirname(__FILE__) +"/../Rakefile"
cp File.dirname(__FILE__) +"/../rhobuild.yml.example", File.dirname(__FILE__) +"/../rhobuild.yml" unless File.exists? File.dirname(__FILE__) +"/../rhobuild.yml"
#hack upon hack. Since build files are modified, all the files need to be writable.
#Only because iphone sim doesn work if you run it with sudo
chmod_R 0777, File.dirname(__FILE__) + "/.."
File.chmod 0755, File.dirname(__FILE__) + "/../bin/get-rhodes-info"
File.chmod 0755, File.dirname(__FILE__) + "/../bin/migrate-rhodes-app"
File.chmod 0755, File.dirname(__FILE__) + "/../bin/rhodes"
File.chmod 0755, File.dirname(__FILE__) + "/../bin/rhodes-setup"
File.chmod 0755, File.dirname(__FILE__) + "/../bin/rhogen"
File.chmod 0755, File.dirname(__FILE__) + "/../bin/set-rhodes-sdk"
File.chmod 0755, File.dirname(__FILE__) + "/../bin/upgrade-rhodes-app"
if RUBY_PLATFORM =~ /darwin/
currentdir = Dir.pwd()
if File.exists?(File.dirname(__FILE__) + "/../platform/osx/bin/RhoSimulator/RhoSimulator.app.zip")
chdir (File.dirname(__FILE__) + "/../platform/osx/bin/RhoSimulator/")
system("unzip RhoSimulator.app.zip")
rm_rf "RhoSimulator.app.zip"
end
Dir.chdir currentdir
end
if RUBY_PLATFORM =~ /darwin/
currentdir = Dir.pwd()
if File.exists?(File.dirname(__FILE__) + "/../lib/extensions/fcm-push/ext/iphone/Frameworks/Frameworks.zip")
chdir (File.dirname(__FILE__) + "/../lib/extensions/fcm-push/ext/iphone/Frameworks/")
system("unzip Frameworks.zip")
rm_rf "Frameworks.zip"
end
Dir.chdir currentdir
end
#This is the hack, we make all the things to make it look like an extension has compiled
File.open('Makefile', 'w') { |f| f.write "all:\n\ninstall:\n\n" }
File.open('make', 'w') do |f|
f.write '#!/bin/sh'
f.chmod f.stat.mode | 0111
end
File.open('rhodes_postinstallhack' + '.so', 'w') { |f| f.chmod 0777}
File.open('rhodes_postinstallhack' + '.dll', 'w') { |f| f.chmod 0777}
File.open('nmake.bat', 'w') { |f| f.write "ECHO \"Done\""
f.chmod 0777}