diff options
author | Philip Withnall <philip.withnall@collabora.co.uk> | 2014-05-06 18:21:45 +0100 |
---|---|---|
committer | Philip Withnall <philip.withnall@collabora.co.uk> | 2014-05-06 18:21:45 +0100 |
commit | fdae443a850196b49364b202893c0894caa3e2f2 (patch) | |
tree | a5273cffb1ad9afd935c81a04bf0370f73275d7b | |
parent | 0bf14b78eee5b745dbe710ed32a43573071bb048 (diff) |
scripts: Support running gnome-clang while uninstalled
It now automatically sets the GNOME_CLANG_PLUGIN variable from the
source directory, if present. The website documentation has also been
updated.
-rw-r--r-- | .be/8443e173-30ee-4e83-9228-9e11414e3432/bugs/5073bef9-f6d5-4bb1-a284-5869ab0bea0b/values | 2 | ||||
-rwxr-xr-x | scripts/gnome-clang | 8 | ||||
-rw-r--r-- | website/index.html | 16 |
3 files changed, 22 insertions, 4 deletions
diff --git a/.be/8443e173-30ee-4e83-9228-9e11414e3432/bugs/5073bef9-f6d5-4bb1-a284-5869ab0bea0b/values b/.be/8443e173-30ee-4e83-9228-9e11414e3432/bugs/5073bef9-f6d5-4bb1-a284-5869ab0bea0b/values index cae7028..8e228f1 100644 --- a/.be/8443e173-30ee-4e83-9228-9e11414e3432/bugs/5073bef9-f6d5-4bb1-a284-5869ab0bea0b/values +++ b/.be/8443e173-30ee-4e83-9228-9e11414e3432/bugs/5073bef9-f6d5-4bb1-a284-5869ab0bea0b/values @@ -26,7 +26,7 @@ - "status": "open", + "status": "fixed", diff --git a/scripts/gnome-clang b/scripts/gnome-clang index 4d30890..2c354fe 100755 --- a/scripts/gnome-clang +++ b/scripts/gnome-clang @@ -4,7 +4,8 @@ clang_bin_dir=`dirname "$0"` clang_prefix="$clang_bin_dir/.." # Try and find the real Clang executable. $GNOME_CLANG_CC trumps everything. -# Otherwise assume clang is in the same directory as this script. +# Otherwise assume clang is in the same directory as this script if they’re both +# installed. Failing that, use a hard-coded Clang path. if [ "x$GNOME_CLANG_CC" != "x" ]; then real_clang="$GNOME_CLANG_CC" elif [ -f "$clang_prefix/bin/clang" ]; then @@ -25,9 +26,14 @@ clang_version=`"$real_clang" --version | head -n1 | cut -f3 -d ' '` # Try and find the gnome-clang plugin. $GNOME_CLANG_PLUGIN trumps everything. if [ "x$GNOME_CLANG_PLUGIN" != "x" ]; then plugin_path="$GNOME_CLANG_PLUGIN" +elif [ -f "$clang_bin_dir/clang-plugin/.libs/libclang-gnome.so" ]; then + # Uninstalled, from the source directory. + plugin_path="$clang_bin_dir/clang-plugin/.libs/libclang-gnome.so" elif [ -f "$clang_prefix/lib64/gnome-clang/$clang_version/libclang-gnome.so" ]; then + # 64-bit installed. plugin_path="$clang_prefix/lib64/gnome-clang/$clang_version/libclang-gnome.so" elif [ -f "$clang_prefix/lib/gnome-clang/$clang_version/libclang-gnome.so" ]; then + # 32-bit installed. plugin_path="$clang_prefix/lib/gnome-clang/$clang_version/libclang-gnome.so" else echo "Error: Could not find libclang-gnome.so. Set GNOME_CLANG_PLUGIN to the absolute path of the gnome-clang plugin." >& 2 diff --git a/website/index.html b/website/index.html index 28fcd85..ddc9dfa 100644 --- a/website/index.html +++ b/website/index.html @@ -111,8 +111,20 @@ not enable GLib-specific warnings.</p> <h3 id="usage-standalone">Standalone usage</h3> -<p>The easiest way to use gnome-clang with the Clang static analyser directly is -to use the <span class="program-name">gnome-clang</span> wrapper script, +<p>The easiest way to use gnome-clang standalone is with the +<span class="program-name">scan-build</span> script which comes with Clang. +e.g.:<br/> +<span class="command">scan-build --use-analyzer=/path/to/bin/gnome-clang -v ./autogen.sh</span><br/> +where <span class="command">./autogen.sh</span> is the command to configure or +build your project (though if a project is configured under +<span class="program-name">scan-build</span>, you only need to run +<span class="command">make</span> normally to perform the static analysis.</p> + +<p>The <span class="program-name">gnome-clang</span> script can be used +installed or uninstalled, straight from the source directory.</p> + +<p>To use gnome-clang with the Clang static analyser directly, use the +<span class="program-name">gnome-clang</span> wrapper script by itself, e.g.:<br/> <span class="command">clang -cc1 -analyze -std=c89 $system_includes my-project/*.c</span><br/> becomes:<br/> |