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.

Files changed (43) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +198 -0
  3. data/bin/easycompile +7 -0
  4. data/doc/DESIGN_DECISIONS.md +34 -0
  5. data/doc/README.gen +181 -0
  6. data/easycompile.gemspec +65 -0
  7. data/lib/easycompile.rb +5 -0
  8. data/lib/easycompile/base/change_directory.rb +28 -0
  9. data/lib/easycompile/base/cmake.rb +53 -0
  10. data/lib/easycompile/base/colours.rb +88 -0
  11. data/lib/easycompile/base/commandline_arguments.rb +37 -0
  12. data/lib/easycompile/base/constants.rb +24 -0
  13. data/lib/easycompile/base/easycompile.rb +22 -0
  14. data/lib/easycompile/base/esystem.rb +59 -0
  15. data/lib/easycompile/base/gem.rb +35 -0
  16. data/lib/easycompile/base/help.rb +35 -0
  17. data/lib/easycompile/base/initialize.rb +33 -0
  18. data/lib/easycompile/base/menu.rb +140 -0
  19. data/lib/easycompile/base/meson_and_ninja.rb +36 -0
  20. data/lib/easycompile/base/misc.rb +1157 -0
  21. data/lib/easycompile/base/opn.rb +27 -0
  22. data/lib/easycompile/base/process_the_input.rb +107 -0
  23. data/lib/easycompile/base/remove.rb +77 -0
  24. data/lib/easycompile/base/reset.rb +140 -0
  25. data/lib/easycompile/base/run.rb +26 -0
  26. data/lib/easycompile/compile_as_appdir/compile_as_appdir.rb +45 -0
  27. data/lib/easycompile/constants/array_possible_archives.rb +45 -0
  28. data/lib/easycompile/constants/constants.rb +21 -0
  29. data/lib/easycompile/constants/file_and_directory_constants.rb +137 -0
  30. data/lib/easycompile/constants/misc.rb +23 -0
  31. data/lib/easycompile/constants/namespace.rb +16 -0
  32. data/lib/easycompile/constants/programs_directory.rb +46 -0
  33. data/lib/easycompile/easycompile/easycompile.rb +80 -0
  34. data/lib/easycompile/project/project.rb +29 -0
  35. data/lib/easycompile/requires/require_the_easycompile_project.rb +13 -0
  36. data/lib/easycompile/requires/require_the_toplevel_methods.rb +11 -0
  37. data/lib/easycompile/toplevel_methods/copy_file.rb +23 -0
  38. data/lib/easycompile/toplevel_methods/misc.rb +54 -0
  39. data/lib/easycompile/toplevel_methods/rinstall2.rb +29 -0
  40. data/lib/easycompile/version/version.rb +26 -0
  41. data/lib/easycompile/yaml/name_of_the_build_directory.yml +1 -0
  42. data/test/testing_easycompile.rb +29 -0
  43. metadata +144 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 6a950ba6612abdfef30e26b8c2c399d5da5b0348d9f6570c6da8dd3a87edda96
4
+ data.tar.gz: 5650efafabc05256ddbfc790fa3df41011c0d0f388c23fa63c53002ce1fe45dd
5
+ SHA512:
6
+ metadata.gz: 4a84893799eac31a1171024d3730c09acb12aac011dac6733a892cc5c33d745771b8a97ba8c61967629030d995aa7e8a8d755115efa7878922eb05d6809e82bb
7
+ data.tar.gz: fe0d9f646a52e8e505a209da9d22d5fb27e7e89a3563669e472e55be36c57f427de4788b559e37a8c7b8729a673897f219b584bc88a6822be62570e03a1d61e2
@@ -0,0 +1,198 @@
1
+ [![forthebadge](http://forthebadge.com/images/badges/built-with-love.svg)](https://www.gobolinux.org/)
2
+ [![forthebadge](http://forthebadge.com/images/badges/made-with-ruby.svg)](https://www.ruby-lang.org/en/)
3
+ [![Gem Version](https://badge.fury.io/rb/easycompile.svg)](https://badge.fury.io/rb/easycompile)
4
+
5
+ ## About this project
6
+
7
+ This project, called **easycompile**, allows the user to
8
+ quickly compile a given **local archive**, such as
9
+ the **foobar-1.2.3.tar.xz** tarball or
10
+ **barfoo-2.2.zip**.
11
+
12
+ In fact: this is the primary use-case for this project, and
13
+ explains why it has been created years ago. I needed a quick
14
+ way to compile a program into the **/usr/** prefix.
15
+
16
+ Let's showcase a few more specific usage examples for
17
+ **easycompile**, in ruby:
18
+
19
+ Easycompile.new('php-7.0.6.tar.xz')
20
+ Easycompile.compile('php-7.0.6.tar.xz')
21
+ Easycompile['php']
22
+
23
+ The above statements all essentially do the same thing: the
24
+ file called **php-7.0.6.tar.xz** will be compiled, if it exists
25
+ locally in the current directory.
26
+
27
+ The last statement, **Easycompile['php']** tries to **find matching
28
+ files** in the current working directory. This is done via a glob
29
+ operation, such as via **Dir[]**. The advantage here is that it
30
+ is **generic** - you do not need to provide the full name of an
31
+ archive to Easycompile. This can be useful if you do not really
32
+ care about any particular version.
33
+
34
+ You can also specify the full location to the target file,
35
+ e. g. the path too, such as **'/opt/php-7.1.2.tar.xz'**,
36
+ as the first argument to **Easycompile.new**.
37
+
38
+ **.gem files** can also be used, such as shown by the
39
+ following example:
40
+
41
+ easycompile rack-2.0.1.gem
42
+
43
+ Remote files could be used as well, in theory, including programs
44
+ offered through the http/https protocol. That is, you could simply
45
+ pass in the **complete URL**, and Easycompile will try to download
46
+ this remote fila via **wget**. However had, this approach is not
47
+ very reliable - it may be best to just simply download the remote
48
+ archive for now, on your own (via wget), and then work on a
49
+ local copy directly.
50
+
51
+ ## History of the Easycompile project
52
+
53
+ I created the project primarily because I managed to break another,
54
+ larger project, called **rbt** (**ruby build tools**) quite a lot in
55
+ the past. When that other project was broken, it typically took some
56
+ time to fix it, and I did not always have that time available at my
57
+ disposal. Since I did not want to use shell scripts for compiling
58
+ different programs, I quickly created this smaller project
59
+ (**easycompile**), and since that day the project helps me to
60
+ quickly compile something **if** rbt is not available, or not
61
+ working. This sums up most of the origins of this project.
62
+
63
+ Since RBT has also improved since that day, the need for
64
+ **easycompile** has diminished - but I keep it around still,
65
+ just in case. **:)**
66
+
67
+ One evident design goal following this history is that the
68
+ Easycompile project has to work when RBT is not available -
69
+ but **if** RBT is available then Easycompile can tap into
70
+ some of the functionality, to enhance support of individual
71
+ aspects necessary for compiling a program. A good example
72
+ for this is to re-use the default configure options that
73
+ the RBT project is tracking.
74
+
75
+ ## Commandline usage for easycompile
76
+
77
+ The commandline variant can be invoked via the **bin/ecompile**
78
+ file. I recommend to use the --user-install option when installing
79
+ easycompile, as all bin/ files will be in a specific
80
+ subdirectory, to which you can then simply modify $PATH for.
81
+
82
+ Say that you have a local file called **php-7.2.0.tar.xz**.
83
+
84
+ Then simply do the following on the commandline:
85
+
86
+ easycompile php-7.2.0.tar.xz
87
+ easycompile php* # Or this variant; is shorter, evidently.
88
+
89
+ ## Support for meson and ninja
90
+
91
+ The easycompile project can compile meson/ninja based programs,
92
+ provided that a file called **meson.build** can be found in the
93
+ **extracted directory**. This requires **a separate build directory**,
94
+ which will default to the name **BUILD_DIRECTORY/** as far as the
95
+ easycompile project is concerned. The name of that build directory
96
+ is kept in a .yml file, the one at
97
+ **easycompile/yaml/name_of_the_build_directory.yml**.
98
+
99
+ ## Commandline options
100
+
101
+ This subsection will show some examples hwo to use the easycompile
102
+ project from the commandline.
103
+
104
+ To compile all local PHP archives in the current working directory:
105
+
106
+ ecompile php*
107
+
108
+ To do the same but specify a particular temp-directory for
109
+ extracting the source archive specifically:
110
+
111
+ ecompile php* --extract-to=/Depot/opt/
112
+ ecompile php* --extract-to=/tmp/
113
+
114
+ To get an overview over the available help options, try:
115
+
116
+ ecompile --help
117
+
118
+ ## Querying whether a given file is an archive
119
+
120
+ A simple toplevel-method can be used to query whether
121
+ a given input (String, such as a filename or filepath)
122
+ is an archive.
123
+
124
+ Usage example:
125
+
126
+ Easycompile.is_an_archive? 'foo.tar.xz' # => true
127
+
128
+ ## Making use of extended configure options
129
+
130
+ If you have the RBT project installed (see it being available
131
+ on rubygems.org) then you can make use of extended configure
132
+ options as well.
133
+
134
+ What are '**extended configure options**'?
135
+
136
+ Take the program called **sed**. In the RBT project, the
137
+ information in how to compile this program from source
138
+ are stored in the file called **sed.yml**.
139
+
140
+ If you look at that file you will notice that it has
141
+ entries for GNU configure, such as --disable-nls and
142
+ --disable-dependency-tracking. These are options that
143
+ the user typically supplies on the commandline, during
144
+ configure, before running **make** and **make install**.
145
+
146
+ By default this is NOT used, so you have to specifically
147
+ enable this for the current invocation of easycompile.
148
+
149
+ Invocation examples:
150
+
151
+ ecompile --sco php*xz
152
+ ecompile --extended-configure-options php*xz
153
+ ecompile --use-configure-options php*xz
154
+
155
+ This would try to compile the php*xz tarball (which has
156
+ to exist, so download it prior to invoking easycompile).
157
+
158
+ Note that **ecompile** is an alias to **easycompile**
159
+ on my computer system.
160
+
161
+ ## Maintenance mode since as of January 2020
162
+
163
+ Do note that the project is in light maintenance mode since as of
164
+ **January 2020**.
165
+
166
+ What this means is that I will mostly do some bug-fixes here and
167
+ there, and perhaps add a few new light features every some months,
168
+ at best.
169
+
170
+ For a more complete suite of software that goes beyond
171
+ the somewhat narrowly defined goals for **Easycompile**,
172
+ I recommend to make use of the **rbt** (**Ruby Build Tools**)
173
+ software suite instead, which has a much wider scope and
174
+ is more sophisticated than **easycompile**.
175
+
176
+ ## Using the home directory as the user prefix
177
+
178
+ You can pass in --home or --homedir to compile into your
179
+ home directory, for the current compilation run. This
180
+ has been added in June 2020 mostly as a convenience
181
+ feature.
182
+
183
+
184
+ ## Contact information
185
+
186
+ If your creative mind has ideas and specific suggestions to make this
187
+ gem more useful in general, feel free to drop me an email at any
188
+ time, via:
189
+
190
+ shevegen@gmail.com
191
+
192
+ (Do keep in mind that responding to emails may take some time, depending
193
+ on the amount of work I may have at that moment, due to reallife. I will,
194
+ however had, read feedback. Patches and code changes are welcome too
195
+ of course, as long as they are in the spirit of the project at
196
+ hand, e. g. fitting to the general theme.)
197
+
198
+ Thank you.
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ require 'easycompile'
6
+
7
+ Easycompile.easycompile(ARGV)
@@ -0,0 +1,34 @@
1
+ The project has a common base, the common actions, and then a specialized
2
+ part. We call the traditional compilation strategy [A], using prefix /usr/,
3
+ and the AppDir approach [B], which will compile into /Programs/NAME/VERSION/
4
+ or /home/Programs/NAME/VERSION/.
5
+
6
+ So as a summary, a short table for this is:
7
+
8
+ [A] '/usr/'
9
+ [B] '/home/Programs/NAME/VERSION/'
10
+
11
+ Common actions possible through this project are:
12
+
13
+ (1) Extraction of an Archive [IMPLEMENTED]
14
+ (2) Installation of gems [IMPLEMENTED]
15
+ (3) Installation via cmake [PARTIALLY IMPLEMENTED]
16
+ (4) Installation via meson/ninja [PARTIALLY IMPLEMENTED]
17
+
18
+ Differential actions are:
19
+
20
+ (1) AppDir compilation and /usr/ prefix compilation will
21
+ logically make use of different prefixes.
22
+ (2) Symlink-actions are only required for the AppDir
23
+ installation approach. For /usr/ we will not need
24
+ to symlink anything.
25
+
26
+ Now that we have defined the common and not common tasks, let's move
27
+ on to how we will do so:
28
+
29
+ - constants.rb # This file will require the other constants.
30
+ - base.rb # is the base class to subclass, called Easycompile::Base.
31
+
32
+ The programs directory is stored in the toplevel instance variable
33
+ called @programs_directory.
34
+
@@ -0,0 +1,181 @@
1
+ ADD_RUBY_BADGE
2
+
3
+ ## About this project
4
+
5
+ This project, called **easycompile**, allows the user to
6
+ quickly compile a given **local archive**, such as
7
+ the **foobar-1.2.3.tar.xz** tarball or
8
+ **barfoo-2.2.zip**.
9
+
10
+ In fact: this is the primary use-case for this project, and
11
+ explains why it has been created years ago. I needed a quick
12
+ way to compile a program into the **/usr/** prefix.
13
+
14
+ Let's showcase a few more specific usage examples for
15
+ **easycompile**, in ruby:
16
+
17
+ Easycompile.new('php-7.0.6.tar.xz')
18
+ Easycompile.compile('php-7.0.6.tar.xz')
19
+ Easycompile['php']
20
+
21
+ The above statements all essentially do the same thing: the
22
+ file called **php-7.0.6.tar.xz** will be compiled, if it exists
23
+ locally in the current directory.
24
+
25
+ The last statement, **Easycompile['php']** tries to **find matching
26
+ files** in the current working directory. This is done via a glob
27
+ operation, such as via **Dir[]**. The advantage here is that it
28
+ is **generic** - you do not need to provide the full name of an
29
+ archive to Easycompile. This can be useful if you do not really
30
+ care about any particular version.
31
+
32
+ You can also specify the full location to the target file,
33
+ e. g. the path too, such as **'/opt/php-7.1.2.tar.xz'**,
34
+ as the first argument to **Easycompile.new**.
35
+
36
+ **.gem files** can also be used, such as shown by the
37
+ following example:
38
+
39
+ easycompile rack-2.0.1.gem
40
+
41
+ Remote files could be used as well, in theory, including programs
42
+ offered through the http/https protocol. That is, you could simply
43
+ pass in the **complete URL**, and Easycompile will try to download
44
+ this remote fila via **wget**. However had, this approach is not
45
+ very reliable - it may be best to just simply download the remote
46
+ archive for now, on your own (via wget), and then work on a
47
+ local copy directly.
48
+
49
+ ## History of the Easycompile project
50
+
51
+ I created the project primarily because I managed to break another,
52
+ larger project, called **rbt** (**ruby build tools**) quite a lot in
53
+ the past. When that other project was broken, it typically took some
54
+ time to fix it, and I did not always have that time available at my
55
+ disposal. Since I did not want to use shell scripts for compiling
56
+ different programs, I quickly created this smaller project
57
+ (**easycompile**), and since that day the project helps me to
58
+ quickly compile something **if** rbt is not available, or not
59
+ working. This sums up most of the origins of this project.
60
+
61
+ Since RBT has also improved since that day, the need for
62
+ **easycompile** has diminished - but I keep it around still,
63
+ just in case. **:)**
64
+
65
+ One evident design goal following this history is that the
66
+ Easycompile project has to work when RBT is not available -
67
+ but **if** RBT is available then Easycompile can tap into
68
+ some of the functionality, to enhance support of individual
69
+ aspects necessary for compiling a program. A good example
70
+ for this is to re-use the default configure options that
71
+ the RBT project is tracking.
72
+
73
+ ## Commandline usage for easycompile
74
+
75
+ The commandline variant can be invoked via the **bin/ecompile**
76
+ file. I recommend to use the --user-install option when installing
77
+ easycompile, as all bin/ files will be in a specific
78
+ subdirectory, to which you can then simply modify $PATH for.
79
+
80
+ Say that you have a local file called **php-7.2.0.tar.xz**.
81
+
82
+ Then simply do the following on the commandline:
83
+
84
+ easycompile php-7.2.0.tar.xz
85
+ easycompile php* # Or this variant; is shorter, evidently.
86
+
87
+ ## Support for meson and ninja
88
+
89
+ The easycompile project can compile meson/ninja based programs,
90
+ provided that a file called **meson.build** can be found in the
91
+ **extracted directory**. This requires **a separate build directory**,
92
+ which will default to the name **BUILD_DIRECTORY/** as far as the
93
+ easycompile project is concerned. The name of that build directory
94
+ is kept in a .yml file, the one at
95
+ **easycompile/yaml/name_of_the_build_directory.yml**.
96
+
97
+ ## Commandline options
98
+
99
+ This subsection will show some examples hwo to use the easycompile
100
+ project from the commandline.
101
+
102
+ To compile all local PHP archives in the current working directory:
103
+
104
+ ecompile php*
105
+
106
+ To do the same but specify a particular temp-directory for
107
+ extracting the source archive specifically:
108
+
109
+ ecompile php* --extract-to=/Depot/opt/
110
+ ecompile php* --extract-to=/tmp/
111
+
112
+ To get an overview over the available help options, try:
113
+
114
+ ecompile --help
115
+
116
+ ## Querying whether a given file is an archive
117
+
118
+ A simple toplevel-method can be used to query whether
119
+ a given input (String, such as a filename or filepath)
120
+ is an archive.
121
+
122
+ Usage example:
123
+
124
+ Easycompile.is_an_archive? 'foo.tar.xz' # => true
125
+
126
+ ## Making use of extended configure options
127
+
128
+ If you have the RBT project installed (see it being available
129
+ on rubygems.org) then you can make use of extended configure
130
+ options as well.
131
+
132
+ What are '**extended configure options**'?
133
+
134
+ Take the program called **sed**. In the RBT project, the
135
+ information in how to compile this program from source
136
+ are stored in the file called **sed.yml**.
137
+
138
+ If you look at that file you will notice that it has
139
+ entries for GNU configure, such as --disable-nls and
140
+ --disable-dependency-tracking. These are options that
141
+ the user typically supplies on the commandline, during
142
+ configure, before running **make** and **make install**.
143
+
144
+ By default this is NOT used, so you have to specifically
145
+ enable this for the current invocation of easycompile.
146
+
147
+ Invocation examples:
148
+
149
+ ecompile --sco php*xz
150
+ ecompile --extended-configure-options php*xz
151
+ ecompile --use-configure-options php*xz
152
+
153
+ This would try to compile the php*xz tarball (which has
154
+ to exist, so download it prior to invoking easycompile).
155
+
156
+ Note that **ecompile** is an alias to **easycompile**
157
+ on my computer system.
158
+
159
+ ## Maintenance mode since as of January 2020
160
+
161
+ Do note that the project is in light maintenance mode since as of
162
+ **January 2020**.
163
+
164
+ What this means is that I will mostly do some bug-fixes here and
165
+ there, and perhaps add a few new light features every some months,
166
+ at best.
167
+
168
+ For a more complete suite of software that goes beyond
169
+ the somewhat narrowly defined goals for **Easycompile**,
170
+ I recommend to make use of the **rbt** (**Ruby Build Tools**)
171
+ software suite instead, which has a much wider scope and
172
+ is more sophisticated than **easycompile**.
173
+
174
+ ## Using the home directory as the user prefix
175
+
176
+ You can pass in --home or --homedir to compile into your
177
+ home directory, for the current compilation run. This
178
+ has been added in June 2020 mostly as a convenience
179
+ feature.
180
+
181
+ ADD_CONTACT_INFORMATION
@@ -0,0 +1,65 @@
1
+ # =========================================================================== #
2
+ # Gemspec for Project Easycompile.
3
+ # =========================================================================== #
4
+ require 'easycompile/version/version.rb'
5
+
6
+ Gem::Specification.new { |s|
7
+
8
+ s.name = 'easycompile'
9
+ s.version = Easycompile::VERSION
10
+ s.date = Time.now.strftime('%Y-%m-%d')
11
+
12
+ DESCRIPTION = <<-EOF
13
+
14
+ This project is called easycompile.
15
+
16
+ It allows you to compile a given source archive, such as a file
17
+ like "php-7.2.0.tar.xz". By default this will compile into the
18
+ prefix /usr/. In order for this to work, the file at hand
19
+ has to exist; in the case above, the file php-7.2.0.tar.xz
20
+ has to exist locally.
21
+
22
+ For more documentation, have a look at the link called
23
+ Documentation on the bottom right side of this webpage.
24
+
25
+ EOF
26
+
27
+ s.summary = DESCRIPTION
28
+ s.description = DESCRIPTION
29
+ s.extra_rdoc_files = %w()
30
+
31
+ # =============================================================== #
32
+ # Show this when a user installs this project.
33
+ # =============================================================== #
34
+ s.post_install_message = <<-EOF
35
+
36
+ You can run this project by issuing:
37
+
38
+ ecompile
39
+
40
+ on the commandline.
41
+
42
+ See
43
+
44
+ ecompile --help
45
+
46
+ for the available options.
47
+
48
+ EOF
49
+
50
+ s.authors = ['Robert A. Heiler']
51
+ s.email = 'shevegen@gmail.com'
52
+ s.files = Dir['**/*']
53
+ s.executables = Dir['bin/*'].map { |f| File.basename(f) }
54
+ s.license = 'GPL-2.0'
55
+ s.homepage = 'http://rubygems.org/gems/easycompile'
56
+
57
+ s.required_ruby_version = '>= '+RUBY_VERSION
58
+ s.required_rubygems_version = '>= '+Gem::VERSION
59
+ s.rubygems_version = '>= '+Gem::VERSION
60
+
61
+ s.add_dependency 'colours'
62
+ s.add_dependency 'opn'
63
+ s.add_dependency 'extracter'
64
+
65
+ }