Mail Archives: cygwin/2007/01/13/01:28:13
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 -