forked from xtingray/tupitube.desk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.rb
executable file
·225 lines (196 loc) · 8.35 KB
/
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
#!/usr/bin/ruby
###########################################################################
# Project TUPI: Magia 2D #
# Project Contact: [email protected] #
# Project Website: http://www.maefloresta.com #
# Project Leader: Gustav Gonzalez <[email protected]> #
# #
# Developers: #
# 2010: #
# Gustavo Gonzalez / xtingray #
# #
# KTooN's versions: #
# #
# 2006: #
# David Cuadrado #
# Jorge Cuadrado #
# 2003: #
# Fernado Roldan #
# Simena Dinas #
# #
# Copyright (C) 2010 Gustav Gonzalez - http://www.maefloresta.com #
# License: #
# This program is free software; you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation; either version 2 of the License, or #
# (at your option) any later version. #
# #
# This program is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with this program. If not, see <http://www.gnu.org/licenses/>. #
###########################################################################
# TODO: This script must detect if every command line given is valid
# Currently, it just try to check if some of them are included or not
# Note: gem install os -v 0.9.6
require 'fileutils'
require_relative 'qonf/configure'
require_relative 'qonf/info'
require_relative 'qonf/defaults'
begin
conf = RQonf::Configure.new(ARGV)
if conf.hasArgument?("help") or conf.hasArgument?("h")
puts <<_EOH_
Use: ./configure [options]
options:
--help: Show this message
--prefix=[path]: Sets installation path [/usr]
--bindir=[path]: Set binaries path [/usr/bin]
--libdir=[path]: Set library path [/usr/lib/tupitube | /usr/lib64/tupitube]
--sharedir=[path]: Set data path [/usr/share]
--with-ffmpeg=[path]: Set ffmpeg installation path [/usr]
--with-quazip=[path]: Set quazip installation path [/usr]
--with-libsndfile=[path]: Set libsndfile installation path [/usr]
--without-ffmpeg: Disable ffmpeg support
--without-debug: Disable debug
--with-qtdir=[path]: Set Qt directory [i.e. /usr/local/qt]
--package-build: Option exclusive for package maintainers
--install-headers: Include header files as part of installation
_EOH_
exit 0
end
debug = 1
if conf.hasArgument?("without-debug")
debug = 0
end
config = RQonf::Config.new
version = "0.2"
codeName = "Marajó"
revision = "20"
configVersion = "5"
Info.info << "Compiling \033[91mTupiTube " + version + "." + revision + "\033[0m (" + codeName + ")" << $endl
Info.info << "Debug support... "
file_name = 'src/components/components.pro'
if debug == 1
var = open(file_name).grep(/debug/)
if var.count == 0
open(file_name, 'a') { |f|
f.puts "SUBDIRS += debug"
}
end
config.addOption("debug")
config.addDefine("TUP_DEBUG")
print "[ \033[92mON\033[0m ]\n"
else
var = open(file_name).grep(/debug/)
if var.count > 0
text = File.read(file_name)
new_contents = text.gsub(/\nSUBDIRS \+\= debug/, "")
File.open(file_name, "w") {|file| file.puts new_contents }
end
config.addOption("release")
config.addDefine("TUP_NODEBUG")
print "[ \033[91mOFF\033[0m ]\n"
end
# config.addDefine("TUP_SERVER")
if conf.hasArgument?("with-ffmpeg") and conf.hasArgument?("without-ffmpeg")
Info.error << " ERROR: Options --with-ffmpeg and --without-ffmpeg are mutually exclusive\n"
exit 0
end
if conf.hasArgument?("with-qtdir")
qtdir = conf.argumentValue("with-qtdir")
conf.verifyQtVersion("5.15.0", debug, qtdir)
else
conf.verifyQtVersion("5.15.0", debug, "")
end
if conf.hasArgument?("with-ffmpeg")
ffmpegDir = conf.argumentValue("with-ffmpeg")
if File.directory? ffmpegDir
ffmpegLib = ffmpegDir + "/lib"
ffmpegInclude = ffmpegDir + "/include"
config.addLib("-L" + ffmpegLib)
config.addIncludePath(ffmpegInclude)
else
Info.error << " ERROR: ffmpeg directory does not exist!\n"
exit 0
end
else
if conf.hasArgument?("without-ffmpeg")
Info.warn << "Disabling ffmpeg support: " << $endl
conf.disableFFmpeg()
end
end
if conf.hasArgument?("with-quazip")
quazipDir = conf.argumentValue("with-quazip")
if File.directory? quazipDir
quazipLib = quazipDir + "/lib"
if RUBY_PLATFORM =~ /linux/
quazipInclude = quazipDir + "/include"
elsif RUBY_PLATFORM =~ /darwin/
quazipInclude = quazipDir + "/include/quazip"
end
config.addLib("-L" + quazipLib)
config.addIncludePath(quazipInclude)
else
Info.error << " ERROR: quazip directory does not exist!\n"
exit 0
end
end
if conf.hasArgument?("with-libsndfile")
libsndfileDir = conf.argumentValue("with-libsndfile")
if File.directory? libsndfileDir
libsndfileLib = libsndfileDir + "/lib"
libsndfileInclude = libsndfileDir + "/include"
config.addLib("-L" + libsndfileLib)
config.addIncludePath(libsndfileInclude)
else
Info.error << " ERROR: libsndfile directory does not exist!\n"
exit 0
end
end
conf.createTests
conf.setTestDir("configure.tests")
conf.runTests(config, conf, debug)
config.addModule("core")
config.addModule("gui")
config.addModule("svg")
config.addModule("xml")
config.addModule("network")
config.addLib("-ltupifwgui")
config.addLib("-ltupifwcore")
# config.addLib("-ltupifwsound")
if conf.hasArgument?("install-headers")
config.addDefine("ADD_HEADERS");
end
config.addDefine('TUPITUBE_VERSION=\\\\\"' + version + '\\\\\"')
config.addDefine('CODE_NAME=\\\\\"' + codeName + '\\\\\"')
config.addDefine('REVISION=\\\\\"' + revision + '\\\\\"')
config.addDefine('CONFIG_VERSION=\\\\\"' + configVersion + '\\\\\"')
if File.exists?('/etc/canaima_version')
config.addDefine("CANAIMA")
end
unix = config.addScope("unix")
unix.addVariable("MOC_DIR", ".moc")
unix.addVariable("UI_DIR", ".ui")
unix.addVariable("OBJECTS_DIR", ".obj")
config.save("tupiglobal.pri")
conf.createMakefiles
binaries = `find configure.tests -mindepth 1 -type d`
array = binaries.split
for item in array
name = item.split("\/")
file = item + "\/" + name[1]
if FileTest.exists?(file)
File.delete(file)
end
end
exec('find configure.tests -iname main.o -exec rm -f {} \;')
rescue => err
Info.error << "Configure failed. error was: #{err.message}\n"
if $DEBUG
puts err.backtrace
end
end