systemlibs: allow building with PREFIX other than /usr

Some use-cases want to build packages in a different path than /usr. For
example to have a set of packages independent from other system
binaries. This change allows building with bazel build
--define=PREFIX=/some/other/path to search that path instead. The
default of /usr is set in bazelrc so that building with no options will
work as before and setting PREFIX on the commandline or later in the
bazelrc will override that setting if desired. PREFIX is not used by the
bundled build so should not affect that at all.

This also adds a few other standard Make variables that can be
overridden independently if needed.

Signed-off-by: Jason Zaman <jason@perfinion.com>
This commit is contained in:
Jason Zaman 2018-08-15 15:20:56 +08:00
parent 57b2fbb598
commit 05b43db45d
2 changed files with 6 additions and 1 deletions

View File

@ -23,7 +23,7 @@ genrule(
cmd = """ cmd = """
for i in $(OUTS); do for i in $(OUTS); do
i=$${i##*/} i=$${i##*/}
ln -vsf /usr/include/jsoncpp/json/$$i $(@D)/include/json/$$i ln -sf $(INCLUDEDIR)/jsoncpp/json/$$i $(@D)/include/json/$$i
done done
""", """,
) )

View File

@ -67,3 +67,8 @@ build -c opt
# Modular TF build options # Modular TF build options
build:dynamic_kernels --define=dynamic_loaded_kernels=true build:dynamic_kernels --define=dynamic_loaded_kernels=true
# Default paths for TF_SYSTEM_LIBS
build --define=PREFIX=/usr
build --define=LIBDIR=$(PREFIX)/lib
build --define=INCLUDEDIR=$(PREFIX)/include