diff options
author | Philip Withnall <philip.withnall@collabora.co.uk> | 2014-05-07 09:28:35 +0100 |
---|---|---|
committer | Philip Withnall <philip.withnall@collabora.co.uk> | 2014-05-07 09:28:35 +0100 |
commit | c2b191a7ebb57a770b35baab3dc19b3c26de75b7 (patch) | |
tree | 1bff2b28dbc88075af9966d260ff72fd4aa8ec31 /scripts | |
parent | 0b54df28f06566f01fb73bede6b20d2338b9c737 (diff) |
build: Rename from gnome-clang to Tartan
Make the name a little less GNOME-centric, since the plugin actually
only (currently) deals with GLib, so has much wider application than
just on GNOME code.
Also, ‘Tartan’ sounds cooler.
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/gnome-clang | 64 | ||||
-rwxr-xr-x | scripts/tartan | 76 |
2 files changed, 76 insertions, 64 deletions
diff --git a/scripts/gnome-clang b/scripts/gnome-clang deleted file mode 100755 index f3a3349..0000000 --- a/scripts/gnome-clang +++ /dev/null @@ -1,64 +0,0 @@ -#!/bin/sh - -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 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 - real_clang="$clang_prefix/bin/clang" -elif [ -f `which clang` ]; then - real_clang=`which clang` -else - echo "Error: Could not find clang executable. Set GNOME_CLANG_CC to the absolute path of the real clang executable." >& 2 -fi - -# Extract the clang version. -# clang --version returns something like: -# clang version 3.3 (tags/RELEASE_33/rc3) -# Target: x86_64-redhat-linux-gnu -# Thread model: posix -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 -fi - -plugin_name=gnome - -# Process GNOME_CLANG_OPTIONS, prefixing everything with -plugin-arg-gnome to -# ensure Clang passes it to (only) the plugin. -plugin_options=() -for arg in $GNOME_CLANG_OPTIONS; do - plugin_options+=( '-plugin-arg-gnome' ) - plugin_options+=( "$arg" ) -done - -# Clang can’t accept -load as the first argument. -first_arg=$1 -shift - -# Exec Clang with the plugin loaded. -exec "$real_clang" \ - "$first_arg" \ - -load "$plugin_path" \ - -add-plugin "$plugin_name" \ - ${plugin_gir_options[@]} \ - ${plugin_options[@]} \ - $GNOME_CLANG_CFLAGS \ - "$@" diff --git a/scripts/tartan b/scripts/tartan new file mode 100755 index 0000000..027fe90 --- /dev/null +++ b/scripts/tartan @@ -0,0 +1,76 @@ +#!/bin/sh + +clang_bin_dir=`dirname "$0"` +clang_prefix="$clang_bin_dir/.." + +# Try and find the real Clang executable. $TARTAN_CC trumps everything. +# 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$TARTAN_CC" != "x" ]; then + real_clang="$TARTAN_CC" +elif [ "x$GNOME_CLANG_CC" != "x" ]; then + # Fallback from before project rename + real_clang="$GNOME_CLANG_CC" +elif [ -f "$clang_prefix/bin/clang" ]; then + real_clang="$clang_prefix/bin/clang" +elif [ -f `which clang` ]; then + real_clang=`which clang` +else + echo "Error: Could not find clang executable. Set TARTAN_CC to the absolute path of the real clang executable." >& 2 +fi + +# Extract the clang version. +# clang --version returns something like: +# clang version 3.3 (tags/RELEASE_33/rc3) +# Target: x86_64-redhat-linux-gnu +# Thread model: posix +clang_version=`"$real_clang" --version | head -n1 | cut -f3 -d ' '` + +# Try and find the Tartan plugin. $TARTAN_PLUGIN trumps everything. +if [ "x$TARTAN_PLUGIN" != "x" ]; then + plugin_path="$TARTAN_PLUGIN" +elif [ "x$GNOME_CLANG_PLUGIN" != "x" ]; then + # Fallback from before project rename + plugin_path="$GNOME_CLANG_PLUGIN" +elif [ -f "$clang_bin_dir/clang-plugin/.libs/libtartan.so" ]; then + # Uninstalled, from the source directory. + plugin_path="$clang_bin_dir/clang-plugin/.libs/libtartan.so" +elif [ -f "$clang_prefix/lib64/tartan/$clang_version/libtartan.so" ]; then + # 64-bit installed. + plugin_path="$clang_prefix/lib64/tartan/$clang_version/libtartan.so" +elif [ -f "$clang_prefix/lib/tartan/$clang_version/libtartan.so" ]; then + # 32-bit installed. + plugin_path="$clang_prefix/lib/tartan/$clang_version/libtartan.so" +else + echo "Error: Could not find libtartan.so. Set TARTAN_PLUGIN to the absolute path of the Tartan plugin." >& 2 +fi + +plugin_name=tartan + +# Process TARTAN_OPTIONS, prefixing everything with -plugin-arg-tartan to +# ensure Clang passes it to (only) the plugin. Also do GNOME_CLANG_OPTIONS as +# a fallback from before the project rename. +plugin_options=() +for arg in $GNOME_CLANG_OPTIONS; do + plugin_options+=( '-plugin-arg-tartan' ) + plugin_options+=( "$arg" ) +done +for arg in $TARTAN_OPTIONS; do + plugin_options+=( '-plugin-arg-tartan' ) + plugin_options+=( "$arg" ) +done + +# Clang can’t accept -load as the first argument. +first_arg=$1 +shift + +# Exec Clang with the plugin loaded. +exec "$real_clang" \ + "$first_arg" \ + -load "$plugin_path" \ + -add-plugin "$plugin_name" \ + ${plugin_gir_options[@]} \ + ${plugin_options[@]} \ + $GNOME_CLANG_CFLAGS \ + $TARTAN_CFLAGS \ + "$@" |