OpenPKG CVS Repository
  http://cvs.openpkg.org/
  ____________________________________________________________________________

  Server: cvs.openpkg.org                  Name:   Ralf S. Engelschall
  Root:   /v/openpkg/cvs                   Email:  [EMAIL PROTECTED]
  Module: openpkg-src                      Date:   16-Aug-2006 20:56:41
  Branch: HEAD                             Handle: 2006081619564000

  Added files:
    openpkg-src/zsh         zsh-wrapper.c zsh.patch
  Modified files:
    openpkg-src/zsh         zsh.spec

  Log:
    - Add a "with_dynamic" build-time option which allows one to build ZSH
      fully dynamically with a libzsh.so and the extensions in numerious
      other DSOs and including a wrapper executable for enhanced run-time
      portability.
    
    - Flag configuration files as %config.
    
    - Install ZSH function scripts.

  Summary:
    Revision    Changes     Path
    1.1         +35 -0      openpkg-src/zsh/zsh-wrapper.c
    1.1         +24 -0      openpkg-src/zsh/zsh.patch
    1.46        +29 -3      openpkg-src/zsh/zsh.spec
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: openpkg-src/zsh/zsh-wrapper.c
  ============================================================================
  $ cvs diff -u -r0 -r1.1 zsh-wrapper.c
  --- /dev/null 2006-08-16 20:55:00 +0200
  +++ zsh-wrapper.c     2006-08-16 20:56:41 +0200
  @@ -0,0 +1,35 @@
  +/*
  +**  zsh-wrapper.c -- ZSH Run-Time Executable Wrapper
  +**  This adjusts the "LD_LIBRARY_PATH" environment variable to let "zsh"
  +**  find "libzsh.so" and is a C program (instead of the expected wrapper
  +**  shell script) to still allow ZSH to be used via Unix "she-bang".
  +*/
  +
  +#include <stdlib.h>
  +#include <string.h>
  +#include <unistd.h>
  +
  +int main(int argn, char **argv)
  +{
  +    char *ldlp_old;
  +    char *ldlp_new;
  +
  +    /* adjust LD_LIBRARY_PATH environment variable */
  +    if ((ldlp_old = getenv("LD_LIBRARY_PATH")) == NULL)
  +        ldlp_old = "/lib:/usr/lib";
  +    if ((ldlp_new = (char *)malloc(strlen(PREFIX "/lib/zsh:") + 
strlen(ldlp_old) + 1)) == NULL)
  +        abort();
  +    strcpy(ldlp_new, PREFIX "/lib/zsh:");
  +    strcat(ldlp_new, ldlp_old);
  +    if (setenv("LD_LIBRARY_PATH", ldlp_new, 1) != 0)
  +        abort();
  +
  +    /* pass-through control to real ZSH executable */
  +    argv[0] = PREFIX "/libexec/zsh/zsh";
  +    if (execv(argv[0], argv) == -1)
  +        abort();
  +
  +    /* not reached */
  +    return 0;
  +}
  +
  @@ .
  patch -p0 <<'@@ .'
  Index: openpkg-src/zsh/zsh.patch
  ============================================================================
  $ cvs diff -u -r0 -r1.1 zsh.patch
  --- /dev/null 2006-08-16 20:55:00 +0200
  +++ zsh.patch 2006-08-16 20:56:41 +0200
  @@ -0,0 +1,24 @@
  +Index: Config/defs.mk.in
  +--- Config/defs.mk.in.orig   2001-12-21 00:48:39 +0100
  ++++ Config/defs.mk.in        2006-08-16 20:02:20 +0200
  +@@ -37,7 +37,7 @@
  + exec_prefix     = @exec_prefix@
  + bindir          = @bindir@
  + libdir          = @libdir@
  +-MODDIR          = $(libdir)/$(tzsh)/$(VERSION)
  ++MODDIR          = $(libdir)
  + infodir         = @infodir@
  + mandir          = @mandir@
  + datadir         = @datadir@
  +Index: Src/Makefile.in
  +--- Src/Makefile.in.orig     2001-12-21 00:48:39 +0100
  ++++ Src/Makefile.in  2006-08-16 20:05:28 +0200
  +@@ -65,7 +65,7 @@
  + NSTMP = stamp-modobjs
  + NLIST = `cat stamp-modobjs`
  + 
  +-LIBZSH = libzsh-$(VERSION).$(DL_EXT)
  ++LIBZSH = libzsh.$(DL_EXT)
  + NIBZSH =
  + INSTLIB = @INSTLIB@
  + UNINSTLIB = @UNINSTLIB@
  @@ .
  patch -p0 <<'@@ .'
  Index: openpkg-src/zsh/zsh.spec
  ============================================================================
  $ cvs diff -u -r1.45 -r1.46 zsh.spec
  --- openpkg-src/zsh/zsh.spec  1 Jan 2006 13:25:01 -0000       1.45
  +++ openpkg-src/zsh/zsh.spec  16 Aug 2006 18:56:40 -0000      1.46
  @@ -33,10 +33,15 @@
   Group:        Shell
   License:      BSD-style
   Version:      4.2.6
  -Release:      20051207
  +Release:      20060816
  +
  +#   package options
  +%option       with_dynamic  no
   
   #   list of sources
   Source0:      ftp://ftp.zsh.org/pub/zsh-%{version}.tar.bz2
  +Source1:      zsh-wrapper.c
  +Patch0:       zsh.patch
   
   #   build information
   Prefix:       %{l_prefix}
  @@ -61,6 +66,7 @@
   
   %prep
       %setup -q
  +    %patch -p0
   
   %build
       ( echo "ac_cv_lib_iconv_iconv=no"
  @@ -71,23 +77,43 @@
           --cache-file=./config.cache \
           --prefix=%{l_prefix} \
           --enable-etcdir=%{l_prefix}/etc/zsh \
  +        --enable-fndir=%{l_prefix}/share/zsh/functions \
  +        --enable-site-fndir=%{l_prefix}/share/zsh/site-functions \
           --disable-locale \
  +%if "%{with_dynamic}" == "yes"
  +        --enable-dynamic
  +%else
           --disable-dynamic
  +%endif
       %{l_make} %{l_mflags}
  +%if "%{with_dynamic}" == "yes"
  +    %{l_cc} %{l_cflags -O} %{l_ldflags} \
  +        '-DPREFIX="%{l_prefix}"' \
  +        -o zsh-wrapper %{SOURCE zsh-wrapper.c}
  +%endif
   
   %install
       rm -rf $RPM_BUILD_ROOT
       %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT
  +%if "%{with_dynamic}" == "yes"
  +    %{l_shtool} mkdir -f -p -m 755 \
  +        $RPM_BUILD_ROOT%{l_prefix}/libexec/zsh
  +    mv  $RPM_BUILD_ROOT%{l_prefix}/bin/zsh \
  +        $RPM_BUILD_ROOT%{l_prefix}/libexec/zsh/zsh
  +    %{l_shtool} install -c -s -m 755 \
  +        zsh-wrapper $RPM_BUILD_ROOT%{l_prefix}/bin/zsh
  +%endif
       %{l_shtool} mkdir -f -p -m 755 \
           $RPM_BUILD_ROOT%{l_prefix}/etc/zsh
       for rc in zshenv zshrc zprofile zlogin zlogout; do
           %{l_shtool} install -c -m 644 /dev/null \
               $RPM_BUILD_ROOT%{l_prefix}/etc/zsh/$rc
       done
  -    rm -rf $RPM_BUILD_ROOT%{l_prefix}/share
       rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/zsh-*
       strip $RPM_BUILD_ROOT%{l_prefix}/bin/* 2>/dev/null || true
  -    %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std}
  +    %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  +        %{l_files_std} \
  +        '%config %{l_prefix}/etc/zsh/*'
   
   %files -f files
   
  @@ .
______________________________________________________________________
The OpenPKG Project                                    www.openpkg.org
CVS Repository Commit List                     [email protected]

Reply via email to