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 config
PREFIX = "/usr"
POSTFIX = ""
DESTDIR = ""
for argv in sys.argv:
@ -48,15 +47,20 @@ oc_other = app_directory("ocarina", ["scripts", "images"])
Default([ocarina, oc_link, oc_other])
env.Alias("ocarina", [ocarina, oc_link, oc_other])
# Install Ocarina
scripts = os.listdir("scripts/")
baselib = PREFIX + "/lib/ocarina" + POSTFIX
lib = DESTDIR + baselib
bin = DESTDIR + PREFIX + "/bin/"
images = lib + "/images"
env.Install(lib, ocarina)
env.Alias("install", [lib, images, bin])
env.Command(images, "./images/", [Copy(images, "./images")])
# Install bin/ and lib/
def install_dirs(dirs):
res = []
for dir in dirs:
target = os.path.join(config.PREFIX, dir)
for file in os.listdir(dir):
source = os.path.join(dir, file)
env.Install(target, source)
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(ocarina, ["include/version.h"])

View File

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