This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

use configured libexecdir when running rpg programs

  • Loading branch information...
1 parent 4496427 commit 75fe7cac2469161ce3ec8eea9ef1b38717c0e961 @rtomayko committed Mar 16, 2010
Showing with 33 additions and 37 deletions.
  1. +10 −9 Makefile
  2. +8 −6 configure
  3. +8 −0 munge.rb
  4. +7 −22 rpg.sh
View
@@ -12,15 +12,15 @@ NAME = rpg
TARNAME = $(NAME)
SHELL = /bin/sh
-srcdir = .
-prefix = /usr/local
-exec_prefix = ${prefix}
-bindir = ${exec_prefix}/bin
-libexecdir = ${exec_prefix}/libexec
-datarootdir = ${prefix}/share
-datadir = ${datarootdir}
-mandir = ${datarootdir}/man
-docdir = $(datadir)/doc/$(TARNAME)
+# srcdir = .
+# prefix = /usr/local
+# exec_prefix = ${prefix}
+# bindir = ${exec_prefix}/bin
+# libexecdir = ${exec_prefix}/libexec
+# datarootdir = ${prefix}/share
+# datadir = ${datarootdir}
+# mandir = ${datarootdir}/man
+# docdir = $(datadir)/doc/$(TARNAME)
# ---- END OF CONFIGURATION ----
@@ -84,6 +84,7 @@ DOCHTML = \
printf " OK\n"
rpg-sh-setup: config.sh munge.rb
+rpg: config.sh munge.rb
build: $(PROGRAMS)
View
@@ -185,6 +185,7 @@ stdutil tar TAR tar gtar
stdutil curl CURL curl
stdutil gem GEM "$(rbconfig bindir)/gem" gem
stdutil schocco SHOCCO shocco
+stdutil rocco ROCCO rocco
stdutil ronn RONN ronn
recordconfig INSTALL_PROGRAM "$INSTALL"
@@ -252,7 +253,7 @@ recordconfig prefix "$prefix"
recordconfig exec_prefix "$exec_prefix"
recordconfig bindir "$bindir"
recordconfig libexecdir "$libexecdir"
-recordconfig localstatedir "$libexecdir"
+recordconfig localstatedir "$localstatedir"
recordconfig sysconfdir "$sysconfdir"
recordconfig datarootdir "$datarootdir"
recordconfig datadir "$datadir"
@@ -289,11 +290,12 @@ EOF
cat <<MESSAGE
configuration:
- ruby: $RUBY
- bindir: $bindir
- libexecdir: $libexecdir
- sysconfdir: $sysconfdir
- mandir: $mandir
+ ruby: $RUBY
+ bindir: $bindir
+ libexecdir: $libexecdir
+ sysconfdir: $sysconfdir
+ localstatedir: $localstatedir
+ mandir: $mandir
MESSAGE
if $develmode
View
@@ -0,0 +1,8 @@
+#!/usr/bin/env ruby
+# Usage: munge SYMBOL FILE
+# Super simple file munger. Reads stdin and replaces SYMBOL with the
+# contents of FILE before writing it to stdout.
+
+data = STDIN.read
+data.gsub!(ARGV[0]) { File.read(ARGV[1]) }
+STDOUT.write data
View
29 rpg.sh
@@ -45,30 +45,15 @@ do
done
shift $(( $OPTIND - 1 ))
-# Bring in rpg config
-. rpg-sh-setup
+# This is replaced by the generated config.sh file at build time.
+: __RPGCONFIG__
+
+# Bring in the rpg sh library.
+. "$bindir"/rpg-sh-setup
# Shift off the first argument to determine the real command:
command="$1"
shift
-if $__SHC__
-then
- case $command in
- build) rpg_build "$@";;
- config) rpg_config "$@";;
- deps) rpg_deps "$@";;
- env) rpg_env "$@";;
- fetch) rpg_fetch "$@";;
- install) rpg_install "$@";;
- list) rpg_list "$@";;
- resolve) rpg_resolve "$@";;
- sh-setup) true ;;
- uninstall) rpg_uninstall "$@";;
- update) rpg_update "$@";;
- version-test) rpg_version_test "$@";;
- *) exec rpg-$command "$@";;
- esac
-else
- exec "rpg-${command}" "$@"
-fi
+# Exec the command or exit with failure if the command doesn't exist.
+exec "$libexecdir/rpg-${command}" "$@"

0 comments on commit 75fe7ca

Please sign in to comment.