-
Notifications
You must be signed in to change notification settings - Fork 0
/
gnu_configure.rb
executable file
·75 lines (66 loc) · 2.18 KB
/
gnu_configure.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/usr/bin/env ruby
require "Classes.rb"
#Checks for GNU Configure script and creates the configure, make and install phases
def gnu_configure_check_create()
credit=0
if FileTest.exist?("configure")
credit=10
if FileTest.exist?("configure.in")
credit+=30
end
if (File.new("configure").read=~/Generated by GNU Autoconf/)
credit+=30
end
end
configure_queue = Array.new
configure_queue.push(generate_configure_phase(Pkgvars.get_configure_args,Pkgvars.get_extra_configure_args))
configure_queue.push(generate_make_phase(Pkgvars.get_make_args))
configure_queue.push(generate_install_phase(Pkgvars.get_install_args))
return configure_queue
end
#Create and fill in the configure phase's contents.
#Does not take care to evaluate the presence of configure.
#The calling function must call it in a suitable way based on the credits.
def generate_configure_phase(configure_args,extra_configure_args)
steps = "./configure \\"
configure_args.each_with_index do |arg,i|
if (i!=(arg.size-1)||extra_configure_args.size!=0)
steps.concat("#{arg} \\")
else
steps.concat(arg)
end
end
extra_configure_args.each_with_index do |arg,i|
if (i!=(arg.size-1))
steps.concat("#{arg} \\")
else
steps.concat(arg)
end
end
configure_phase = Phase.new("gnu_configure",steps)
return configure_phase
end
#Create and fill in the make phase's contents.
#Does not take care to evaluate the presence of make.
#The calling function must call it in a suitable way based on the credits.
def generate_make_phase(make_args)
steps = "make "
make_args.each_with_index do |arg,i|
steps.concat("#{arg} ")
end
make_phase = Phase.new("gnu_make",steps)
return make_phase
end
#Create and fill in the install phase's contents.
#Does not take care to evaluate the presence of install.
#The calling function must call it in a suitable way based on the credits.
def generate_install_phase(install_args)
steps = "make "
install_args.each_with_index do |arg,i|
steps.concat("#{arg} ")
end
steps.concat("DESTDIR=#{Sysvars.get_rpm_build_root} ")
steps.concat("install")
install_phase = Phase.new("gnu_install",steps)
return install_phase
end