bin/install_megadrivers: fix DESTDIR and -D*-path
[mesa.git] / bin / install_megadrivers.py
index 7931a544bd27678db2bccaca3f8f696d728e48e7..c04a2a3eb342ba391c15029d393dfe3507aca08e 100755 (executable)
@@ -1,6 +1,6 @@
 #!/usr/bin/env python
 # encoding=utf-8
-# Copyright © 2017 Intel Corporation
+# Copyright © 2017-2018 Intel Corporation
 
 # Permission is hereby granted, free of charge, to any person obtaining a copy
 # of this software and associated documentation files (the "Software"), to deal
@@ -35,7 +35,11 @@ def main():
     parser.add_argument('drivers', nargs='+')
     args = parser.parse_args()
 
-    to = os.path.join(os.environ.get('MESON_INSTALL_DESTDIR_PREFIX'), args.libdir)
+    if os.path.isabs(args.libdir):
+        to = os.path.join(os.environ.get('DESTDIR', '/'), args.libdir[1:])
+    else:
+        to = os.path.join(os.environ['MESON_INSTALL_DESTDIR_PREFIX'], args.libdir)
+
     master = os.path.join(to, os.path.basename(args.megadriver))
 
     if not os.path.exists(to):