summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Bieneman <chris.bieneman@me.com>2019-08-21 01:48:28 +0000
committerChris Bieneman <chris.bieneman@me.com>2019-08-21 01:48:28 +0000
commit8d18384809957cc923752e10a86adab129e3df48 (patch)
treec8cf271548a282bcd27d86a99c5591b6a8fb81f1
parent4b3c0fd5da2ef595ea8e015a8e38a48890057eed (diff)
downloadbcm5719-llvm-8d18384809957cc923752e10a86adab129e3df48.tar.gz
bcm5719-llvm-8d18384809957cc923752e10a86adab129e3df48.zip
Autogenerate the shebang lines for tools/opt-viewer
Summary: Since these files depend on the built python modules, they need to use the right python binary to run them. So use configure_file to set the right shebang line. Patch By: cbiesinger (Christian Biesinger) Reviewers: chandlerc, beanz, anemet Reviewed By: anemet Subscribers: compnerd, JDevlieghere, mgorny, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D65983 llvm-svn: 369486
-rw-r--r--llvm/CMakeLists.txt2
-rw-r--r--llvm/tools/opt-viewer/CMakeLists.txt21
-rwxr-xr-xllvm/tools/opt-viewer/opt-diff.py.in (renamed from llvm/tools/opt-viewer/opt-diff.py)2
-rwxr-xr-xllvm/tools/opt-viewer/opt-stats.py.in (renamed from llvm/tools/opt-viewer/opt-stats.py)2
-rwxr-xr-xllvm/tools/opt-viewer/opt-viewer.py.in (renamed from llvm/tools/opt-viewer/opt-viewer.py)2
-rw-r--r--llvm/tools/opt-viewer/optrecord.py.in (renamed from llvm/tools/opt-viewer/optrecord.py)2
6 files changed, 24 insertions, 7 deletions
diff --git a/llvm/CMakeLists.txt b/llvm/CMakeLists.txt
index 678f1a74bdd..0e77e0ebdeb 100644
--- a/llvm/CMakeLists.txt
+++ b/llvm/CMakeLists.txt
@@ -660,6 +660,8 @@ if( ${PYTHON_VERSION_STRING} VERSION_LESS 2.7 )
message(FATAL_ERROR "Python 2.7 or newer is required")
endif()
+get_filename_component(PYTHON_BASENAME ${PYTHON_EXECUTABLE} NAME)
+
######
# LLVMBuild Integration
#
diff --git a/llvm/tools/opt-viewer/CMakeLists.txt b/llvm/tools/opt-viewer/CMakeLists.txt
index 19b60693308..1864c2b60b1 100644
--- a/llvm/tools/opt-viewer/CMakeLists.txt
+++ b/llvm/tools/opt-viewer/CMakeLists.txt
@@ -1,13 +1,28 @@
set (files
+ "optpmap.py"
+ "style.css")
+
+set (generated_files
"opt-diff.py"
"opt-stats.py"
"opt-viewer.py"
- "optpmap.py"
- "optrecord.py"
- "style.css")
+ "optrecord.py")
+
+foreach (file ${generated_files})
+ configure_file(
+ ${CMAKE_CURRENT_SOURCE_DIR}/${file}.in
+ ${CMAKE_CURRENT_BINARY_DIR}/${file})
+endforeach (file)
foreach (file ${files})
install(PROGRAMS ${file}
DESTINATION share/opt-viewer
COMPONENT opt-viewer)
endforeach (file)
+
+
+foreach (file ${generated_files})
+ install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${file}
+ DESTINATION share/opt-viewer
+ COMPONENT opt-viewer)
+endforeach (file)
diff --git a/llvm/tools/opt-viewer/opt-diff.py b/llvm/tools/opt-viewer/opt-diff.py.in
index 36e81a5d569..a561bb626d0 100755
--- a/llvm/tools/opt-viewer/opt-diff.py
+++ b/llvm/tools/opt-viewer/opt-diff.py.in
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env @PYTHON_BASENAME@
from __future__ import print_function
diff --git a/llvm/tools/opt-viewer/opt-stats.py b/llvm/tools/opt-viewer/opt-stats.py.in
index f4ee3a7d44e..4f102861663 100755
--- a/llvm/tools/opt-viewer/opt-stats.py
+++ b/llvm/tools/opt-viewer/opt-stats.py.in
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env @PYTHON_BASENAME@
from __future__ import print_function
diff --git a/llvm/tools/opt-viewer/opt-viewer.py b/llvm/tools/opt-viewer/opt-viewer.py.in
index 4c105886cfd..288e01ea1d1 100755
--- a/llvm/tools/opt-viewer/opt-viewer.py
+++ b/llvm/tools/opt-viewer/opt-viewer.py.in
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env @PYTHON_BASENAME@
from __future__ import print_function
diff --git a/llvm/tools/opt-viewer/optrecord.py b/llvm/tools/opt-viewer/optrecord.py.in
index f6fd772689a..79d377c34fa 100644
--- a/llvm/tools/opt-viewer/optrecord.py
+++ b/llvm/tools/opt-viewer/optrecord.py.in
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env @PYTHON_BASENAME@
from __future__ import print_function
OpenPOWER on IntegriCloud