|
@@ -2,7 +2,9 @@ namespace Usm {
|
|
|
|
|
|
public class Paths {
|
|
|
|
|
|
+ public string destination { get; set; }
|
|
|
public string prefix { get; set; }
|
|
|
+
|
|
|
public string bin { get; set; }
|
|
|
public string include { get; set; }
|
|
|
public string data { get; set; }
|
|
@@ -17,6 +19,7 @@ namespace Usm {
|
|
|
public string sys_config { get; set; }
|
|
|
|
|
|
public void set_envs() {
|
|
|
+ Environment.set_variable("DESTDIR", destination, true);
|
|
|
Environment.set_variable("PREFIX", prefix, true);
|
|
|
Environment.set_variable("BINDIR", bin, true);
|
|
|
Environment.set_variable("INCLUDEDIR", include, true);
|
|
@@ -34,38 +37,51 @@ namespace Usm {
|
|
|
|
|
|
public string get_suggested_path(ResourceRef resource) {
|
|
|
switch (resource.resource_type) {
|
|
|
+ case ResourceType.ROOT_PATH:
|
|
|
+ return Path.build_filename(destination, resource.resource);
|
|
|
+ case ResourceType.PATH:
|
|
|
+ return Path.build_filename(destination, prefix, resource.resource);
|
|
|
+ case ResourceType.OPTIONAL:
|
|
|
+ return Path.build_filename(destination, "opt", resource.resource);
|
|
|
case Usm.ResourceType.RESOURCE:
|
|
|
- return resource.resource;
|
|
|
+ return Path.build_filename(destination, prefix, "share", resource.resource);
|
|
|
+ case ResourceType.CONFIGURATION:
|
|
|
+ return Path.build_filename(destination, "etc", resource.resource);
|
|
|
case Usm.ResourceType.BINARY:
|
|
|
- return Path.build_filename(prefix, bin, resource.resource);
|
|
|
+ return Path.build_filename(destination, prefix, bin, resource.resource);
|
|
|
case Usm.ResourceType.SUPER_BINARY:
|
|
|
- return Path.build_filename(prefix, sbin, resource.resource);
|
|
|
+ return Path.build_filename(destination, prefix, sbin, resource.resource);
|
|
|
case Usm.ResourceType.LIBRARY:
|
|
|
- return Path.build_filename(prefix, lib, resource.resource);
|
|
|
+ return Path.build_filename(destination, prefix, lib, resource.resource);
|
|
|
case Usm.ResourceType.LIBRARY_EXECUTABLE:
|
|
|
- return Path.build_filename(prefix, libexec, resource.resource);
|
|
|
+ return Path.build_filename(destination, prefix, libexec, resource.resource);
|
|
|
case Usm.ResourceType.LIBRARY_RESOURCE:
|
|
|
- return Path.build_filename(prefix, lib, resource.resource);
|
|
|
+ return Path.build_filename(destination, prefix, lib, resource.resource);
|
|
|
case Usm.ResourceType.INFO_PAGE:
|
|
|
- return Path.build_filename(prefix, info, resource.resource);
|
|
|
+ return Path.build_filename(destination, prefix, info, resource.resource);
|
|
|
case Usm.ResourceType.MANUAL_PAGE:
|
|
|
- return Path.build_filename(prefix, man, resource.resource);
|
|
|
+ return Path.build_filename(destination, prefix, man, resource.resource);
|
|
|
case Usm.ResourceType.LOCALE:
|
|
|
- return Path.build_filename(prefix, locale, resource.resource);
|
|
|
+ return Path.build_filename(destination, prefix, locale, resource.resource);
|
|
|
case Usm.ResourceType.APPLICATION:
|
|
|
- return Path.build_filename(prefix, "share", "applications", resource.resource);
|
|
|
+ return Path.build_filename(destination, prefix, "share", "applications", resource.resource);
|
|
|
case Usm.ResourceType.INCLUDE:
|
|
|
- return Path.build_filename(prefix, include, resource.resource);
|
|
|
+ return Path.build_filename(destination, prefix, include, resource.resource);
|
|
|
case Usm.ResourceType.PKG_CONFIG:
|
|
|
- return Path.build_filename(prefix, lib, "pkgconfig", resource.resource);
|
|
|
+ return Path.build_filename(destination, prefix, lib, "pkgconfig", resource.resource);
|
|
|
case Usm.ResourceType.VALA_API:
|
|
|
- return Path.build_filename(prefix, "share", "vala", "vapi", resource.resource);
|
|
|
+ return Path.build_filename(destination, prefix, "share", "vala", "vapi", resource.resource);
|
|
|
+ case Usm.ResourceType.GOBJECT_IR:
|
|
|
+ return Path.build_filename(destination, prefix, "share", "gir", resource.resource);
|
|
|
+ case Usm.ResourceType.TYPELIB:
|
|
|
+ return Path.build_filename(destination, prefix, lib, "girepository-1.0", resource.resource);
|
|
|
default:
|
|
|
assert_not_reached();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public Paths.defaults() {
|
|
|
+ destination = "/";
|
|
|
prefix = "/usr";
|
|
|
bin = "bin";
|
|
|
include = "include";
|
|
@@ -84,6 +100,7 @@ namespace Usm {
|
|
|
public Paths.usm_environ() {
|
|
|
var defaults = new Paths.defaults();
|
|
|
|
|
|
+ destination = Environment.get_variable("USM_DESTDIR") ?? defaults.destination;
|
|
|
prefix = Environment.get_variable("USM_PREFIX") ?? defaults.prefix;
|
|
|
bin = Environment.get_variable("USM_BINDIR") ?? defaults.bin;
|
|
|
include = Environment.get_variable("USM_INCLUDEDIR") ?? defaults.include;
|