blob: d240407c38c32d2c6160d9c4d5ab3b459559047d [file] [log] [blame]
#!/bin/sh
set -e
libnih_dir="$(dirname "$0")"
src_dir="$PWD"
if [ "$1" = "--help" ] || [ "$#" -gt 1 ]; then
echo "Usage: nihify [DIR]" 1>&2
echo "Create symlinks in DIR to libnih components" 1>&2
echo 1>&2
echo "If DIR is not specified, the current directory is used" 1>&2
exit 1
fi
if [ -n "$1" ]; then
src_dir="$1"
fi
if [ "$libnih_dir" = "$src_dir" ] || [ -f "$src_dir/nihify" ]; then
echo "nihify must be run from the source you wish to symlink into" 1>&2
exit 1
fi
if [ ! -f "$src_dir/configure.ac" ]; then
echo "directory ($src_dir) missing configure.ac" 1>&2
exit 1
fi
libnih_dir="$(cd "$libnih_dir" && pwd)"
src_dir="$(cd "$src_dir" && pwd)"
[ ! -L "$src_dir/ChangeLog.nih" ] || rm "$src_dir/ChangeLog.nih"
echo "Creating symlink to ChangeLog as ChangeLog.nih"
ln -s "$libnih_dir/ChangeLog" "$src_dir/ChangeLog.nih"
for SYMLINK in nih nih-dbus \
m4/Makefile.am m4/compiler.m4 m4/linker.m4 m4/misc.m4 \
m4/libs.m4; do
[ -e "$libnih_dir/$SYMLINK" ]
[ ! -L "$src_dir/$SYMLINK" ] || rm "$src_dir/$SYMLINK"
echo "Creating symlink to $SYMLINK"
ln -s "$libnih_dir/$SYMLINK" "$src_dir/$SYMLINK"
done
if ! grep "^NIH_INIT" "$src_dir/configure.ac" >/dev/null 2>&1; then
echo
echo "Remember to add NIH_INIT to configure.ac"
fi