build: Improve install target and create uninstall target

Install files in bin and lib.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
This commit is contained in:
Bryan Schumaker 2012-06-02 11:50:32 -04:00
parent 3d9f21837e
commit e4a3b8902f
2 changed files with 17 additions and 10 deletions

View File

@ -2,7 +2,6 @@
import os, sys import os, sys
import config import config
PREFIX = "/usr"
POSTFIX = "" POSTFIX = ""
DESTDIR = "" DESTDIR = ""
for argv in sys.argv: for argv in sys.argv:
@ -48,15 +47,20 @@ oc_other = app_directory("ocarina", ["scripts", "images"])
Default([ocarina, oc_link, oc_other]) Default([ocarina, oc_link, oc_other])
env.Alias("ocarina", [ocarina, oc_link, oc_other]) env.Alias("ocarina", [ocarina, oc_link, oc_other])
# Install Ocarina # Install bin/ and lib/
scripts = os.listdir("scripts/") def install_dirs(dirs):
baselib = PREFIX + "/lib/ocarina" + POSTFIX res = []
lib = DESTDIR + baselib for dir in dirs:
bin = DESTDIR + PREFIX + "/bin/" target = os.path.join(config.PREFIX, dir)
images = lib + "/images" for file in os.listdir(dir):
env.Install(lib, ocarina) source = os.path.join(dir, file)
env.Alias("install", [lib, images, bin]) env.Install(target, source)
env.Command(images, "./images/", [Copy(images, "./images")]) res += [target]
return res
dirs = install_dirs(["bin/", "lib/"])
env.Alias("install", dirs)
env.Command("uninstall", None, Delete(FindInstalledFiles()))
# Clean up the build directory # Clean up the build directory
Clean(ocarina, ["include/version.h"]) Clean(ocarina, ["include/version.h"])

View File

@ -7,6 +7,9 @@ BUG = 0
EXTRA = "rc" EXTRA = "rc"
DEBUG = True DEBUG = True
# Install prefix
PREFIX = "/usr"
env = None env = None
application = "libsaria" application = "libsaria"