Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
These just define some functions to return the install paths determined at build-time.
- Loading branch information
1 parent
1a19bf2
commit 16d294a
Showing
4 changed files
with
114 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
// snogpaths.cc -- Handling of installation paths | ||
// | ||
// Copyright (C) 2012 Miles Bader <miles@gnu.org> | ||
// | ||
// This source code is free software; you can redistribute it and/or | ||
// modify it under the terms of the GNU General Public License as | ||
// published by the Free Software Foundation; either version 3, or (at | ||
// your option) any later version. See the file COPYING for more details. | ||
// | ||
// Written by Miles Bader <miles@gnu.org> | ||
// | ||
|
||
#include "snogpaths-data.h" | ||
|
||
#include "snogpaths.h" | ||
|
||
|
||
// | ||
// Currently these functions just return the statically configured | ||
// install paths. | ||
// | ||
// A better method would be try and make everything "relocatable", by | ||
// detecting the run-time install prefix, and making other names | ||
// relative to that. This can be done as follows: | ||
// | ||
// 1. Determine the absolute runtime name of the executable. | ||
// There should be a function that main calls to pass in | ||
// argv[0]; it can be used as-is if absolute, or searched for | ||
// in PATH if not. | ||
// | ||
// 2. Determine the relative bindir suffix by removing the static | ||
// install prefix from the static bindir (if the static bindir | ||
// is not relative to the static prefix, give up). | ||
// | ||
// 3. Remove the filename and relative bindir suffix from the end | ||
// of the absolute runtime executable name (if they don't | ||
// match, give up), yielding the runtime prefix. | ||
// | ||
// 4. Determine the relative suffixes for other paths (datadir, | ||
// etc) by removing the static prefix from their static | ||
// versions, as in (2). | ||
// | ||
// 5. Append the runtime prefix and the relative suffixes | ||
// determined in (4) to yield the absolute runtime paths. | ||
// | ||
|
||
std::string | ||
snogray::installed_prefix () | ||
{ | ||
return SNOGRAY_PREFIX; | ||
} | ||
|
||
std::string | ||
snogray::installed_bindir () | ||
{ | ||
return SNOGRAY_BINDIR; | ||
} | ||
|
||
std::string | ||
snogray::installed_pkgdatadir () | ||
{ | ||
return SNOGRAY_PKGDATADIR; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// snogpaths.h -- Handling of installation paths | ||
// | ||
// Copyright (C) 2012 Miles Bader <miles@gnu.org> | ||
// | ||
// This source code is free software; you can redistribute it and/or | ||
// modify it under the terms of the GNU General Public License as | ||
// published by the Free Software Foundation; either version 3, or (at | ||
// your option) any later version. See the file COPYING for more details. | ||
// | ||
// Written by Miles Bader <miles@gnu.org> | ||
// | ||
|
||
#ifndef SNOGRAY_SNOGPATHS_H | ||
#define SNOGRAY_SNOGPATHS_H | ||
|
||
#include <string> | ||
|
||
|
||
namespace snogray { | ||
|
||
std::string installed_prefix (); | ||
std::string installed_bindir (); | ||
std::string installed_pkgdatadir (); | ||
|
||
} | ||
|
||
#endif // SNOGRAY_SNOGPATHS_H |