easycompile 1.0.6
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of easycompile might be problematic. Click here for more details.
- checksums.yaml +7 -0
- data/README.md +198 -0
- data/bin/easycompile +7 -0
- data/doc/DESIGN_DECISIONS.md +34 -0
- data/doc/README.gen +181 -0
- data/easycompile.gemspec +65 -0
- data/lib/easycompile.rb +5 -0
- data/lib/easycompile/base/change_directory.rb +28 -0
- data/lib/easycompile/base/cmake.rb +53 -0
- data/lib/easycompile/base/colours.rb +88 -0
- data/lib/easycompile/base/commandline_arguments.rb +37 -0
- data/lib/easycompile/base/constants.rb +24 -0
- data/lib/easycompile/base/easycompile.rb +22 -0
- data/lib/easycompile/base/esystem.rb +59 -0
- data/lib/easycompile/base/gem.rb +35 -0
- data/lib/easycompile/base/help.rb +35 -0
- data/lib/easycompile/base/initialize.rb +33 -0
- data/lib/easycompile/base/menu.rb +140 -0
- data/lib/easycompile/base/meson_and_ninja.rb +36 -0
- data/lib/easycompile/base/misc.rb +1157 -0
- data/lib/easycompile/base/opn.rb +27 -0
- data/lib/easycompile/base/process_the_input.rb +107 -0
- data/lib/easycompile/base/remove.rb +77 -0
- data/lib/easycompile/base/reset.rb +140 -0
- data/lib/easycompile/base/run.rb +26 -0
- data/lib/easycompile/compile_as_appdir/compile_as_appdir.rb +45 -0
- data/lib/easycompile/constants/array_possible_archives.rb +45 -0
- data/lib/easycompile/constants/constants.rb +21 -0
- data/lib/easycompile/constants/file_and_directory_constants.rb +137 -0
- data/lib/easycompile/constants/misc.rb +23 -0
- data/lib/easycompile/constants/namespace.rb +16 -0
- data/lib/easycompile/constants/programs_directory.rb +46 -0
- data/lib/easycompile/easycompile/easycompile.rb +80 -0
- data/lib/easycompile/project/project.rb +29 -0
- data/lib/easycompile/requires/require_the_easycompile_project.rb +13 -0
- data/lib/easycompile/requires/require_the_toplevel_methods.rb +11 -0
- data/lib/easycompile/toplevel_methods/copy_file.rb +23 -0
- data/lib/easycompile/toplevel_methods/misc.rb +54 -0
- data/lib/easycompile/toplevel_methods/rinstall2.rb +29 -0
- data/lib/easycompile/version/version.rb +26 -0
- data/lib/easycompile/yaml/name_of_the_build_directory.yml +1 -0
- data/test/testing_easycompile.rb +29 -0
- metadata +144 -0
@@ -0,0 +1,21 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# This file gets included into base.rb of module Easycompile.
|
6
|
+
# =========================================================================== #
|
7
|
+
# require 'easycompile/constants/constants.rb'
|
8
|
+
# include Easycompile::Constants
|
9
|
+
# =========================================================================== #
|
10
|
+
require 'easycompile/project/project.rb'
|
11
|
+
require 'easycompile/constants/array_possible_archives.rb'
|
12
|
+
require 'easycompile/constants/file_and_directory_constants.rb'
|
13
|
+
require 'easycompile/constants/misc.rb'
|
14
|
+
require 'easycompile/constants/namespace.rb'
|
15
|
+
require 'easycompile/constants/programs_directory.rb'
|
16
|
+
|
17
|
+
module Easycompile
|
18
|
+
|
19
|
+
module Constants # === Easycompile::Constants
|
20
|
+
|
21
|
+
end; end
|
@@ -0,0 +1,137 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# require 'easycompile/constants/file_and_directory_constants.rb'
|
6
|
+
# =========================================================================== #
|
7
|
+
require 'easycompile/project/project.rb'
|
8
|
+
|
9
|
+
module Easycompile
|
10
|
+
|
11
|
+
module Constants # === Easycompile::Constants
|
12
|
+
|
13
|
+
# ========================================================================= #
|
14
|
+
# === MESON_BUILD_FILE
|
15
|
+
#
|
16
|
+
# Refer to the name of the default meson-build file, which is
|
17
|
+
# meson.build.
|
18
|
+
# ========================================================================= #
|
19
|
+
MESON_BUILD_FILE = 'meson.build'
|
20
|
+
|
21
|
+
# ========================================================================= #
|
22
|
+
# === CMAKE_FILE
|
23
|
+
#
|
24
|
+
# Refer to the name of the default cmake-file, which is called
|
25
|
+
# CMakeLists.txt.
|
26
|
+
# ========================================================================= #
|
27
|
+
CMAKE_FILE = 'CMakeLists.txt'
|
28
|
+
|
29
|
+
# ========================================================================= #
|
30
|
+
# === FILE_NAME_OF_THE_BUILD_DIRECTORY
|
31
|
+
# ========================================================================= #
|
32
|
+
FILE_NAME_OF_THE_BUILD_DIRECTORY =
|
33
|
+
"#{PROJECT_BASE_DIRECTORY}yaml/name_of_the_build_directory.yml"
|
34
|
+
|
35
|
+
# ========================================================================= #
|
36
|
+
# === LAST_DOWNLOADED_FILE
|
37
|
+
# ========================================================================= #
|
38
|
+
LAST_DOWNLOADED_FILE = "#{ENV['HOME']}/LAST_DOWNLOADED_FILE.md"
|
39
|
+
|
40
|
+
# ========================================================================= #
|
41
|
+
# === INDIVIDUAL_COOKBOOKS
|
42
|
+
#
|
43
|
+
# This will currently use a hardcoded path, which is only useful on
|
44
|
+
# my home setup..
|
45
|
+
# ========================================================================= #
|
46
|
+
INDIVIDUAL_COOKBOOKS =
|
47
|
+
'/home/x/DATA/PROGRAMMING_LANGUAGES/RUBY/src/'\
|
48
|
+
'rbt/lib/rbt/yaml/cookbooks/'
|
49
|
+
|
50
|
+
# ========================================================================= #
|
51
|
+
# === RUBY_SRC
|
52
|
+
#
|
53
|
+
# This constant is guaranteed to have the last character a '/'. It is
|
54
|
+
# only useful on my home setup, though - other users won't need this
|
55
|
+
# constant.
|
56
|
+
# ========================================================================= #
|
57
|
+
if ENV['RUBY_SRC']
|
58
|
+
RUBY_SRC = ENV['RUBY_SRC'].to_s+'/'
|
59
|
+
else
|
60
|
+
RUBY_SRC = '/home/x/DATA/PROGRAMMING_LANGUAGES/RUBY/src/'
|
61
|
+
end
|
62
|
+
|
63
|
+
# ========================================================================= #
|
64
|
+
# === ruby_src?
|
65
|
+
# ========================================================================= #
|
66
|
+
def ruby_src?
|
67
|
+
RUBY_SRC
|
68
|
+
end
|
69
|
+
|
70
|
+
# ========================================================================= #
|
71
|
+
# === LOCATION_OF_SETUP_RB
|
72
|
+
#
|
73
|
+
# We can simply make use of the RUBY_SRC constant here.
|
74
|
+
# ========================================================================= #
|
75
|
+
LOCATION_OF_SETUP_RB =
|
76
|
+
"#{RUBY_SRC}roebe/lib/roebe/setup/setup.rb"
|
77
|
+
|
78
|
+
# ========================================================================= #
|
79
|
+
# === SRC_DIR
|
80
|
+
#
|
81
|
+
# This constant is guaranteed to have the last character a '/'.
|
82
|
+
# ========================================================================= #
|
83
|
+
if ENV['SRC_DIR']
|
84
|
+
SRC_DIR = ENV['SRC_DIR'].to_s+'/'
|
85
|
+
else
|
86
|
+
SRC_DIR = '/home/x/src/'
|
87
|
+
end
|
88
|
+
|
89
|
+
# ========================================================================= #
|
90
|
+
# === source_dir?
|
91
|
+
# ========================================================================= #
|
92
|
+
def source_dir?
|
93
|
+
SRC_DIR
|
94
|
+
end; alias src_dir? source_dir? # === src_dir?
|
95
|
+
|
96
|
+
# ========================================================================= #
|
97
|
+
# === TEMP_DIR
|
98
|
+
# ========================================================================= #
|
99
|
+
if ENV['MY_TEMP']
|
100
|
+
TEMP_DIR = ENV['MY_TEMP'].to_s.dup+'/'
|
101
|
+
elsif Dir.exist? '/home/Temp'
|
102
|
+
TEMP_DIR = '/home/Temp/'
|
103
|
+
else
|
104
|
+
TEMP_DIR = '/tmp/'
|
105
|
+
end
|
106
|
+
|
107
|
+
# ========================================================================= #
|
108
|
+
# === temp_dir?
|
109
|
+
# ========================================================================= #
|
110
|
+
def self.temp_dir?
|
111
|
+
TEMP_DIR
|
112
|
+
end; self.instance_eval { alias temp_directory? temp_dir? } # === Easycompile::Constants.temp_directory?
|
113
|
+
|
114
|
+
end
|
115
|
+
|
116
|
+
# =========================================================================== #
|
117
|
+
# === Easycompile.temp_dir?
|
118
|
+
# =========================================================================== #
|
119
|
+
def self.temp_dir?
|
120
|
+
Constants::TEMP_DIR
|
121
|
+
end; self.instance_eval { alias temp_directory? temp_dir? } # === Easycompile.temp_directory?
|
122
|
+
|
123
|
+
# =========================================================================== #
|
124
|
+
# === Easycompile.source_dir?
|
125
|
+
# =========================================================================== #
|
126
|
+
def self.source_dir?
|
127
|
+
Constants::SRC_DIR
|
128
|
+
end; self.instance_eval { alias src_dir? source_dir? } # === Easycompile.src_dir?
|
129
|
+
|
130
|
+
# =========================================================================== #
|
131
|
+
# === Easycompile.ruby_src_dir?
|
132
|
+
# =========================================================================== #
|
133
|
+
def self.ruby_src_dir?
|
134
|
+
Constants::RUBY_SRC
|
135
|
+
end; self.instance_eval { alias ruby_src? ruby_src_dir? } # === Easycompile.ruby_src?
|
136
|
+
|
137
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# require 'easycompile/constants/misc.rb'
|
6
|
+
# =========================================================================== #
|
7
|
+
module Easycompile
|
8
|
+
|
9
|
+
module Constants # === Easycompile::Constants
|
10
|
+
|
11
|
+
# ========================================================================= #
|
12
|
+
# === ERROR_LINE
|
13
|
+
# ========================================================================= #
|
14
|
+
ERROR_LINE = ' 2>&1'.freeze
|
15
|
+
|
16
|
+
# ========================================================================= #
|
17
|
+
# === SHALL_WE_CREATE_A_BUILD_DIRECTORY
|
18
|
+
#
|
19
|
+
# If true then we will create a build directory called "BUILD".
|
20
|
+
# ========================================================================= #
|
21
|
+
SHALL_WE_CREATE_A_BUILD_DIRECTORY = false
|
22
|
+
|
23
|
+
end; end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# require 'easycompile/constants/namespace.rb'
|
6
|
+
# =========================================================================== #
|
7
|
+
module Easycompile
|
8
|
+
|
9
|
+
module Constants # === Easycompile::Constants
|
10
|
+
|
11
|
+
# ========================================================================= #
|
12
|
+
# === NAMESPACE
|
13
|
+
# ========================================================================= #
|
14
|
+
NAMESPACE = 'Easycompile' # The toplevel namespace. Easycompile::Constants::NAMESPACE
|
15
|
+
|
16
|
+
end; end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# require 'easycompile/constants/programs_directory.rb'
|
6
|
+
# =========================================================================== #
|
7
|
+
module Easycompile
|
8
|
+
|
9
|
+
module Constants # === Easycompile::Constants
|
10
|
+
|
11
|
+
# ========================================================================= #
|
12
|
+
# === PROGRAMS_DIRECTORY
|
13
|
+
# ========================================================================= #
|
14
|
+
if ENV['MY_PROGRAMS']
|
15
|
+
PROGRAMS_DIRECTORY = ENV['MY_PROGRAMS'].to_s+'/'
|
16
|
+
else
|
17
|
+
PROGRAMS_DIRECTORY = '/home/Programs/'
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
|
22
|
+
# =========================================================================== #
|
23
|
+
# === @programs_directory
|
24
|
+
#
|
25
|
+
# This toplevel instance variable keeps track of the programs directory
|
26
|
+
# in use for easycompile.
|
27
|
+
# =========================================================================== #
|
28
|
+
@programs_directory = Constants::PROGRAMS_DIRECTORY
|
29
|
+
|
30
|
+
# =========================================================================== #
|
31
|
+
# === Easycompile.set_programs_directory
|
32
|
+
# =========================================================================== #
|
33
|
+
def self.set_programs_directory(i)
|
34
|
+
i = i.dup if i.frozen?
|
35
|
+
i << '/' unless i.end_with? '/'
|
36
|
+
@programs_directory = i
|
37
|
+
end
|
38
|
+
|
39
|
+
# =========================================================================== #
|
40
|
+
# === Easycompile.programs_directory?
|
41
|
+
# =========================================================================== #
|
42
|
+
def self.programs_directory?
|
43
|
+
@programs_directory
|
44
|
+
end; self.instance_eval { alias programs_dir? programs_directory? } # === Easycompile.programs_dir?
|
45
|
+
|
46
|
+
end
|
@@ -0,0 +1,80 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# === Easycompile::Easycompile
|
6
|
+
#
|
7
|
+
# This will extract an archive, then compile into the given prefix,
|
8
|
+
# which defaults to /usr/ for this class.
|
9
|
+
# =========================================================================== #
|
10
|
+
require 'easycompile/base/easycompile.rb'
|
11
|
+
|
12
|
+
module Easycompile # === Easycompile::Easycompile
|
13
|
+
|
14
|
+
class Easycompile < Base
|
15
|
+
|
16
|
+
# ========================================================================= #
|
17
|
+
# === initialize
|
18
|
+
#
|
19
|
+
# We can use more advanced compile instructions such as:
|
20
|
+
#
|
21
|
+
# Easycompile::Easycompile.new(i, extract_to: EXTRACT_TO)
|
22
|
+
#
|
23
|
+
# The first argument is the name of the program in question.
|
24
|
+
# ========================================================================= #
|
25
|
+
def initialize(
|
26
|
+
i = nil,
|
27
|
+
run_already = true,
|
28
|
+
&block
|
29
|
+
)
|
30
|
+
set_prefix '/usr' # This is the default prefix anyway.
|
31
|
+
super(i, :dont_run_yet)
|
32
|
+
if run_already.is_a? Hash
|
33
|
+
set_hash(run_already) # Here the prefix can be overruled.
|
34
|
+
run_already = true
|
35
|
+
end
|
36
|
+
if i.is_a? Array
|
37
|
+
i = i.first
|
38
|
+
end
|
39
|
+
if i.end_with? '.yml'
|
40
|
+
i = return_yaml_file(i)
|
41
|
+
set_original_input(i)
|
42
|
+
end
|
43
|
+
# ======================================================================= #
|
44
|
+
# === Handle blocks next
|
45
|
+
# ======================================================================= #
|
46
|
+
if block_given?
|
47
|
+
yielded = yield
|
48
|
+
# ===================================================================== #
|
49
|
+
# === Handle Hashes next
|
50
|
+
# ===================================================================== #
|
51
|
+
if yielded.is_a? Hash
|
52
|
+
# =================================================================== #
|
53
|
+
# === { :prefix => :appdir }
|
54
|
+
#
|
55
|
+
# This is the default entry point for programs that are compiled
|
56
|
+
# via an AppDir prefix.
|
57
|
+
# =================================================================== #
|
58
|
+
if yielded.has_key? :prefix
|
59
|
+
set_prefix(
|
60
|
+
yielded[:prefix]
|
61
|
+
)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
set_original_input(i)
|
66
|
+
run if run_already # Call the parent method.
|
67
|
+
end
|
68
|
+
|
69
|
+
# ========================================================================= #
|
70
|
+
# === Easycompile[]
|
71
|
+
# ========================================================================= #
|
72
|
+
def self.[](i)
|
73
|
+
new(i)
|
74
|
+
end
|
75
|
+
|
76
|
+
end; end
|
77
|
+
|
78
|
+
if __FILE__ == $PROGRAM_NAME
|
79
|
+
puts Easycompile::Easycompile.new(ARGV)
|
80
|
+
end # ecompile
|
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# require 'easycompile/project/project.rb'
|
6
|
+
# =========================================================================== #
|
7
|
+
module Easycompile
|
8
|
+
|
9
|
+
# ========================================================================= #
|
10
|
+
# === Easycompile::PROJECT_BASE_DIRECTORY
|
11
|
+
# ========================================================================= #
|
12
|
+
PROJECT_BASE_DIRECTORY =
|
13
|
+
File.absolute_path("#{__dir__}/..")+'/'
|
14
|
+
|
15
|
+
# ========================================================================= #
|
16
|
+
# === Easycompile::PROJECT_BASE_DIR
|
17
|
+
#
|
18
|
+
# This is simply an "alias" to the above constant.
|
19
|
+
# ========================================================================= #
|
20
|
+
PROJECT_BASE_DIR = PROJECT_BASE_DIRECTORY
|
21
|
+
|
22
|
+
# ========================================================================= #
|
23
|
+
# === Easycompile.project_base_dir?
|
24
|
+
# ========================================================================= #
|
25
|
+
def self.project_base_dir?
|
26
|
+
PROJECT_BASE_DIRECTORY
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# require 'easycompile/requires/require_the_easycompile_project.rb'
|
6
|
+
# =========================================================================== #
|
7
|
+
require 'easycompile/constants/constants.rb'
|
8
|
+
require 'easycompile/project/project.rb'
|
9
|
+
require 'easycompile/version/version.rb'
|
10
|
+
require 'easycompile/base/easycompile.rb'
|
11
|
+
require 'easycompile/requires/require_the_toplevel_methods.rb'
|
12
|
+
require 'easycompile/easycompile/easycompile.rb'
|
13
|
+
require 'easycompile/compile_as_appdir/compile_as_appdir.rb'
|
@@ -0,0 +1,11 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# require 'easycompile/requires/require_the_toplevel_methods.rb'
|
6
|
+
# =========================================================================== #
|
7
|
+
require 'easycompile/project/project.rb'
|
8
|
+
|
9
|
+
Dir["#{Easycompile.project_base_dir?}toplevel_methods/*.rb"].each {|this_file|
|
10
|
+
require "easycompile/toplevel_methods/#{File.basename(this_file)}"
|
11
|
+
}
|
@@ -0,0 +1,23 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# require 'easycompile/toplevel_methods/copy_file.rb'
|
6
|
+
# =========================================================================== #
|
7
|
+
module Easycompile
|
8
|
+
|
9
|
+
require 'fileutils'
|
10
|
+
|
11
|
+
# ========================================================================= #
|
12
|
+
# === Easycompile.copy_file
|
13
|
+
#
|
14
|
+
# The second argument to this method specifies the target-location
|
15
|
+
# where the file should be copied onto.
|
16
|
+
# ========================================================================= #
|
17
|
+
def self.copy_file(
|
18
|
+
from, to = Dir.pwd
|
19
|
+
)
|
20
|
+
FileUtils.cp(from, to)
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# Here we collect methods which are directly available on the module
|
6
|
+
# level of the project.
|
7
|
+
# =========================================================================== #
|
8
|
+
# require 'easycompile/toplevel_methods/misc.rb'
|
9
|
+
# =========================================================================== #
|
10
|
+
module Easycompile
|
11
|
+
|
12
|
+
require 'easycompile/constants/constants.rb'
|
13
|
+
# ========================================================================= #
|
14
|
+
# We wish to include these constants onto the toplevel module next.
|
15
|
+
# ========================================================================= #
|
16
|
+
include Easycompile::Constants
|
17
|
+
|
18
|
+
require 'easycompile/easycompile/easycompile.rb'
|
19
|
+
require 'easycompile/compile_as_appdir/compile_as_appdir.rb'
|
20
|
+
# ========================================================================= #
|
21
|
+
# === Easycompile.compile
|
22
|
+
#
|
23
|
+
# This method must be able to tap into CompileAsAppdir, as well
|
24
|
+
# as invoke Easycompile, so both .rb files are required here.
|
25
|
+
#
|
26
|
+
# If no input is given then a random entry will be fetched.
|
27
|
+
#
|
28
|
+
# Invocation example:
|
29
|
+
#
|
30
|
+
# Easycompile.compile('wv.yml', :appdir)
|
31
|
+
#
|
32
|
+
# ========================================================================= #
|
33
|
+
def self.compile(
|
34
|
+
i = nil, optional_compile_as_appdir = false
|
35
|
+
)
|
36
|
+
if i.nil?
|
37
|
+
i = try_to_randomly_fetch_an_archive_from_the_current_directory
|
38
|
+
end
|
39
|
+
case optional_compile_as_appdir
|
40
|
+
when :appdir
|
41
|
+
# ===================================================================== #
|
42
|
+
# Make it more explicit in this case.
|
43
|
+
# ===================================================================== #
|
44
|
+
optional_compile_as_appdir = true
|
45
|
+
end
|
46
|
+
if optional_compile_as_appdir
|
47
|
+
::Easycompile::CompileAsAppdir[i]
|
48
|
+
else
|
49
|
+
::Easycompile::Easycompile.new(i)
|
50
|
+
end
|
51
|
+
end; self.instance_eval { alias easycompile compile } # === Easycompile.easycompile
|
52
|
+
self.instance_eval { alias [] compile } # === Easycompile[]
|
53
|
+
|
54
|
+
end
|