delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2007/01/13/01:28:13

X-Spam-Check-By: sourceware.org
Message-ID: <45A87BE8.5000108@cwilson.fastmail.fm>
Date: Sat, 13 Jan 2007 01:27:52 -0500
From: Charles Wilson <cygwin AT cwilson DOT fastmail DOT fm>
User-Agent: Thunderbird 1.5.0.9 (Windows/20061207)
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: [patch] cygport-0.2.7 hooks for additional prep, install customization
References: <459F1407 DOT 3010200 AT cwilson DOT fastmail DOT fm> <45A759DE DOT 2080304 AT users DOT sourceforge DOT net>
In-Reply-To: <45A759DE.2080304@users.sourceforge.net>
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

Yaakov (Cygwin Ports) wrote:
> Could you please provide a sample .cygport showing what would be
> accomplished with this?

Well, there's the src_prep_init|fini_hook example used in the 
jpeg.cygport (from the mixed-mode-demo tarball).  Again, the extra 
SRC_URIs are all unpacked automatically by cygport, but then the 
specific package .cygport has to DO something with those contents, if 
the extra SRC_URIs are not just .patch files.

In which case they should be in PATCH_URI, instead.

>> Obviously, I prefer [2], which is implemented below for the prep and
>> install stages.
> 
> Refresh my memory, what is the need for the src_install hooks?

rxvt-unicode-X is a good example of that:

rxvt-unicode-X has $PN = "rxvt-unicode-X" but all documentation is 
provided by the subpackage rxvt-unicode-common, and I want that 
documentation to be in
   /usr/share/doc/rxvt-unicode-${PV}/
and NOT either of
    /usr/share/doc/rxvt-unicode-X-${PV}/
    /usr/share/doc/rxvt-unicode-common-${PV}/

cygport is rather insistent that ${P}[== ${PN}-${PV}] and subdirectories 
under ${P} will used throughout for docdir (it's even hardcoded in 
/usr/lib/cygport/bin/dodoc).  And that's a good thing, for almost any 
package.  So, rather than trying to overload the current behavior with a 
lot of brittle logic, I added instead a patch that allowed me to "go 
with the flow", and then "clean up" afterwards:

src_install_fini_hook() {
         cd ${D}
         mv usr/share/doc/${P} usr/share/doc/${BASE_PN}-${PV}
}

Much simpler.

src_prep_init_hook is called at the first point in src_prep that makes 
any sense at all, and src_prep_fini_hook is called as the very last act 
of src_prep.

src_install_init_hook is called as the very first act of 'install)' -- 
even before __prepinstalldirs.  I'm not sure what good this will do, but 
it's there for symmetry. (and if it came after __prepinstalldirs, then 
those customizations should go at the top of src_install() anyway!)

As for src_install_fini_hook -- well, sometimes you need to take care of 
business AFTER src_postinst() does its thing:
   __prepdoc && __prepetc && __prepman && __prepstrip

Now, rxvt-unicode-X.cygport depends on the mixed-mode patch, the "hooks" 
patch, and "multiple postinstall/preremove scripts" patch.  The 
rxvt.cygport uses both
     src_prep_init_hook()
and src_install_fini_hook().

I've put hooks-demo.tar.bz2 here:
    http://cygutils.fruitbat.org/ITP/hooks-demo.tar.bz2
It contains:

rxvt-unicode-X-7.7-6.cygport
rxvt-unicode-X-7.7-6.cygwin.patch
rxvt-unicode-X-7.7-6.src.patch
uwc-7.7-6.zip

Note that the src_prep_init_hook() runs a script contained in the 
uwc-7.7-6.zip zipfile.  That script is a little chatty, the following 
(encountered during 'cygport ... prep' is not an error:

Appending include to rxvt.h
Adding uwc.o to Makefile and Makefile.in
grep: Makefile: No such file or directory
sed: can't read Makefile: No such file or directory
Transforming files to use u_ versions of multi-byte functions
Removing identical copies of transformed files
command.C ../command.C differ: char 5505, line 202
init.C ../init.C differ: char 15335, line 557
main.C ../main.C differ: char 2354, line 65
misc.C ../misc.C differ: char 1423, line 32
rxvt.h ../rxvt.h differ: char 21316, line 689
rxvtfont.C ../rxvtfont.C differ: char 14456, line 427
screen.C ../screen.C differ: char 25445, line 851
Saving original versions of transformed files to sav/
Copying transformed versions to ./

Enjoy...

--
Chuck

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019