1 # UCW Library configuration system: installation paths
2 # (c) 2005--2009 Martin Mares <mj@ucw.cz>
3 # (c) 2006 Robert Spalek <robert@ucw.cz>
4 # (c) 2008 Michal Vaner <vorner@ucw.cz>
6 package UCW::Configure::Paths;
12 Log "Determining installation prefix ... ";
13 if (IsSet("CONFIG_LOCAL")) {
15 Set("INSTALL_PREFIX", "");
16 Set("INSTALL_USR_PREFIX", "");
17 Set("INSTALL_VAR_PREFIX", "");
19 Set("PREFIX", "/usr/local") unless IsSet("PREFIX");
20 my $ipx = Get("PREFIX");
22 Set("INSTALL_PREFIX", "$ipx/");
23 my $upx = ($ipx eq "" ? "/usr/" : "$ipx/");
24 Set("INSTALL_USR_PREFIX", $upx);
25 $upx =~ s{^/usr\b}{/var};
26 Set("INSTALL_VAR_PREFIX", $upx);
27 Log(Get("PREFIX") . "\n");
30 Set('CONFIG_DIR', 'etc') unless IsSet('CONFIG_DIR');
31 Set('INSTALL_CONFIG_DIR', Get('INSTALL_PREFIX') . Get('CONFIG_DIR'));
32 Set('INSTALL_BIN_DIR', Get('INSTALL_USR_PREFIX') . 'bin');
33 Set('INSTALL_SBIN_DIR', Get('INSTALL_USR_PREFIX') . 'sbin');
34 Set('INSTALL_LIB_DIR', Get('INSTALL_USR_PREFIX') . 'lib');
35 Set('INSTALL_INCLUDE_DIR', Get('INSTALL_USR_PREFIX') . 'include');
36 Set('INSTALL_PKGCONFIG_DIR', Get('INSTALL_USR_PREFIX') . 'lib/pkgconfig');
37 Set('INSTALL_SHARE_DIR', Get('INSTALL_USR_PREFIX') . 'share');
38 Set('INSTALL_MAN_DIR', Get('INSTALL_USR_PREFIX') . 'share/man');
39 Set('INSTALL_LOG_DIR', Get('INSTALL_VAR_PREFIX') . 'log');
40 Set('INSTALL_STATE_DIR', Get('INSTALL_VAR_PREFIX') . 'lib');
41 Set('INSTALL_RUN_DIR', Get('INSTALL_VAR_PREFIX') . 'run');
42 Set('INSTALL_DOC_DIR', Get('INSTALL_USR_PREFIX') . 'share/doc');
43 Set('INSTALL_PERL_DIR', Get('INSTALL_LIB_DIR') . '/perl5');
45 # Remember PKG_CONFIG_PATH used for building, so that it will be propagated to
46 # pkg-config's run locally in the makefiles.
47 Set("PKG_CONFIG_PATH", $ENV{"PKG_CONFIG_PATH"}) if defined $ENV{"PKG_CONFIG_PATH"};