This module autodetects various platform-specific information, and provides that information through constants.
GEM_HOME | = | gem_home |
RUBY_ENGINE | = | ::RUBY_ENGINE |
RUBY_ENGINE | = | "ruby" |
The C compiler flags that are necessary to compile an Apache module. Also includes APR and APU compiler flags if with_apr_flags is true.
Linker flags that are necessary for linking an Apache module. Already includes APR and APU linker flags.
Returns whether it is necessary to use information outputted by ‘apr-config’ and ‘apu-config’ in order to compile an Apache module. When Apache is installed with —with-included-apr, the APR/APU headers are placed into the same directory as the Apache headers, and so ‘apr-config’ and ‘apu-config’ won‘t be necessary in that case.
Returns whether compiling C++ with -fvisibility=hidden might result in tons of useless warnings, like this: code.google.com/p/phusion-passenger/issues/detail?id=526 This appears to be a bug in older g++ versions: gcc.gnu.org/ml/gcc-patches/2006-07/msg00861.html Warnings should be suppressed with -Wno-attributes.
Returns a list of all CPU architecture names that the current machine CPU supports. If there are multiple such architectures then the first item in the result denotes that OS runtime‘s main/preferred architecture.
This function normalizes some names. For example x86 is always reported as "x86" regardless of whether the OS reports it as "i386" or "i686". x86_64 is always reported as "x86_64" even if the OS reports it as "amd64".
Please note that even if the CPU supports multiple architectures, the operating system might not. For example most x86 CPUs nowadays also support x86_64, but x86_64 Linux systems require various x86 compatibility libraries to be installed before x86 executables can be run. This function does not detect whether these compatibility libraries are installed. The only guarantee that you have is that the OS can run executables in the architecture denoted by the first item in the result.
For example, on x86_64 Linux this function can return ["x86_64", "x86"]. This indicates that the CPU supports both of these architectures, and that the OS‘s main/preferred architecture is x86_64. Most executables on the system are thus be x86_64. It is guaranteed that the OS can run x86_64 executables, but not x86 executables per se.
Another example: on MacOS X this function can return either
OS X 10.6 (Snow Leopard) and beyond because starting from that version everything is 64-bit by default. The latter result indicates an OS X version older than 10.6.
Returns an identifier string that describes the current platform‘s binary compatibility with regard to C/C++ binaries. Two systems with the same binary compatibility identifiers are able to run the same C/C++ binaries.
The the string depends on the following factors:
Check whether the specified command is in $PATH, and return its absolute filename. Returns nil if the command is not found.
This function exists because system(‘which’) doesn‘t always behave correctly, for some weird reason.
When `is_executable` is true, this function checks whether there is an executable named `name` in $PATH. When false, it assumes that `name` is not an executable name but a command string (e.g. "ccache gcc"). It then infers the executable name ("ccache") from the command string, and checks for that instead.
Looks for the given C or C++ header. This works by invoking the compiler and searching in the compiler‘s header search path. Returns its full filename, or true if this function knows that the header exists but can‘t find it (e.g. because the compiler cannot tell us what its header search path is). Returns nil if the header cannot be found.
The absolute path to the Apache binary (that is, ‘httpd’, ‘httpd2’, ‘apache’ or ‘apache2’), or nil if not found.
Autodetects the current Linux distribution and return a number of identifier tags. The first tag identifies the distribution while the other tags indicate which distributions it is likely compatible with. Returns nil if the operating system is not Linux.
Locates a Ruby tool command, e.g. ‘gem’, ‘rake’, ‘bundle’, etc. Instead of naively looking in $PATH, this function uses a variety of search heuristics to find the command that‘s really associated with the current Ruby interpreter. It should never locate a command that‘s actually associated with a different Ruby interpreter. Returns nil when nothing‘s found.
Returns the operating system‘s name. This name is in lowercase and contains no spaces, and thus is suitable to be used in some kind of ID. E.g. "linux", "macosx".
Returns whether Phusion Passenger needs Ruby development headers to be available for the current Ruby implementation.
Compiler flags that should be used for compiling every C/C++ program, for portability reasons. These flags should be specified as last when invoking the compiler.
Linker flags that should be used for linking every C/C++ program, for portability reasons. These flags should be specified as last when invoking the linker.
Returns the absolute path to the Rake executable that belongs to the current Ruby interpreter. Returns nil if it doesn‘t exist.
The return value may not be the actual correct invocation for Rake. Use rake_command for that.
Returns the correct command string for invoking the Rake executable that belongs to the current Ruby interpreter. Returns nil if Rake is not found.
Returns the absolute path to the RSpec runner program that belongs to the current Ruby interpreter. Returns nil if it doesn‘t exist.
Returns correct command for invoking the current Ruby interpreter. In case of RVM this function will return the path to the RVM wrapper script that executes the current Ruby interpreter in the currently active gem set.
Returns the full path to the current Ruby interpreter‘s executable file. This might not be the actual correct command to use for invoking the Ruby interpreter; use ruby_command instead.
Returns an array of identifiers that describe the current Ruby interpreter‘s extension binary compatibility. A Ruby extension compiled for a certain Ruby interpreter can also be loaded on a different Ruby interpreter with the same binary compatibility identifiers.
The identifiers depend on the following factors:
Returns either ‘sudo’ or ‘rvmsudo’ depending on whether the current Ruby interpreter is managed by RVM.
Returns the RVM installation mode: :single - RVM is installed in single-user mode. :multi - RVM is installed in multi-user mode. :mixed - RVM is in a mixed-mode installation. nil - The current Ruby interpreter is not using RVM.
If the current Ruby interpreter is managed by RVM, returns all directories in which RVM places its working files. This is usually ~/.rvm or /usr/local/rvm, but in mixed-mode installations there can be multiple such paths.
Otherwise returns nil.
If the current Ruby interpreter is managed by RVM, returns the RVM name which identifies the current Ruby interpreter plus the currently active gemset, e.g. something like this: "ruby-1.9.2-p0@mygemset"
Returns nil otherwise.
Returns the directory in which test executables should be placed. The returned directory is guaranteed to be writable and guaranteed to not be mounted with the ‘noexec’ option. If no such directory can be found then it will raise a PlatformInfo::RuntimeError with an appropriate error message.