forked from fuse4x/fuse
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.rb
More file actions
executable file
·54 lines (43 loc) · 1.93 KB
/
build.rb
File metadata and controls
executable file
·54 lines (43 loc) · 1.93 KB
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
52
53
54
#!/usr/bin/env ruby
# Possible flags are:
# --debug this builds distribuition with debug flags enabled
# --root DIR install the binary into this directory. If this flag is not set - the script
# redeploys kext to local machine and restarts it
# --clean clean before build
CWD = File.dirname(__FILE__)
KEXT_DIR = '/System/Library/Extensions/'
Dir.chdir(CWD)
debug = ARGV.include?('--debug')
clean = ARGV.include?('--clean')
root_dir = ARGV.index('--root') ? ARGV[ARGV.index('--root') + 1] : nil
abort("root directory #{root_dir} does not exist") if ARGV.index('--root') and not File.exists?(root_dir)
if File.exists?("../kext/build.rb") then
# kext project exists - let's check that common files are the same
common_files = [
['include/fuse_param.h', 'common/fuse_param.h'],
['include/fuse_mount.h', 'common/fuse_mount.h'],
['include/fuse_version.h', 'common/fuse_version.h'],
['include/fuse_kernel.h', 'fuse_kernel.h'],
]
for pair in common_files do
fuse_file,kext_file = *pair
kext_file = '../kext/' + kext_file
abort("File #{fuse_file} does not exist") unless File.exists?(fuse_file)
abort("File #{kext_file} does not exist") unless File.exists?(kext_file)
system("diff #{fuse_file} #{kext_file}") or abort("Files #{fuse_file} and #{kext_file} are different")
end
end
system('git clean -xdf') if clean
unless File.exists?('Makefile') then
system("autoreconf -f -i -Wall,no-obsolete") or abort
system("./configure --disable-dependency-tracking --disable-static") or abort
end
system("make -s -j3") or abort
cmd = 'sudo make install'
system(cmd)
if root_dir
# fuse is a special subproject. Other pieces (such as framework and sshfs) depend on it,
# or be precise depend on fuse installed to /usr/local/lib. So in case if we build distribution package
# we still install it to both places, to system and to root dir.
system(cmd + ' DESTDIR=' + root_dir)
end