This is the mail archive of the cygwin-apps mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: cygport: variable package names


Yaakov, Ping?

my workaround has a problem, see below.

On Apr 29 20:20, Corinna Vinschen wrote:
> On Apr 29 15:59, Corinna Vinschen wrote:
> > Hi Yaakov,
> > 
> > While packaging openssl it occured to me that I had lost a feature of my
> > old packaging script.  The script evaluated the version number of the
> > runtime package and created the package name from there:
> > [...]
> > I tried to resurrect it, but it doesn't work.  What I did was to replace
> > the aforementioned four lines with the following:
> > 
> >   eval `grep '^SHLIB_VERSION_NUMBER=' ${B}/Makefile`
> >   if [ -z "${SHLIB_VERSION_NUMBER}" ]
> >   then
> >     echo "Error: Couldn't retrieve OpenSSL shared lib version from Makefile."
> >     echo " Check value of variable SHLIB_VERSION_NUMBER in Makefile."
> >     exit 1
> >   fi
> >   SHLIB_VERSION="${SHLIB_VERSION_NUMBER//[!0-9]/}"
> >   PKG_NAMES="openssl openssl-devel libopenssl${SHLIB_VERSION}"
> >   openssl_CONTENTS="etc usr/bin/openssl.exe [...]"
> >   openssl_devel_CONTENTS="usr/include usr/lib/*.a [...]"
> >   eval libopenssl${SHLIB_VERSION}_CONTENTS="usr/bin/cyg*dll"
> >   
> > The problem is, that the cygport file is apparently (and obviously I
> > guess) included before important variables are set.  So, at the point
> > the top-level stuff in the cygport file is evaluated, variables like
> > ${S} or ${B} are just not set.  Therefore, the above fails with
> > 
> >   grep: /Makefile: No such file or directory
> >   Error: Couldn't retrieve OpenSSL shared lib version from Makefile.
> >   Check value of variable SHLIB_VERSION_NUMBER in Makefile.
> > 
> > That means, I can't create variable package names, at least I don't
> > understand how I could do it.  Is that possible in a different way?
> 
> Just FYI, I found a workaround:
> 
>   eval_pkgnames() {
>     pushd ${B}
>     eval `grep '^SHLIB_VERSION_NUMBER=' ${B}/Makefile`
>     [ -z "${SHLIB_VERSION_NUMBER}" ] && \
>       error "Couldn't retrieve OpenSSL shared lib version from Makefile.\n" \
> 	    " Check value of variable SHLIB_VERSION_NUMBER in Makefile."
>     SHLIB_VERSION="${SHLIB_VERSION_NUMBER//[!0-9]/}"
>     popd
>     cat > "${P}-${PR}.pkginfo" <<- EOF
> 	  PKG_NAMES="openssl openssl-devel libopenssl${SHLIB_VERSION}"
> 	  openssl_CONTENTS="etc usr/bin/openssl.exe usr/bin/c_rehash
> 			    usr/lib/engines usr/share/doc usr/ssl/certs
> 			    usr/ssl/man/man[157] usr/ssl/misc
> 			    usr/ssl/openssl.cnf usr/ssl/private"
> 	  openssl_devel_CONTENTS="usr/include usr/lib/*.a usr/lib/pkgconfig
> 				  usr/ssl/man/man3"
> 	  libopenssl${SHLIB_VERSION}_CONTENTS="usr/bin/cyg*dll"
> 	  EOF
>   }
> 
>   [ -f "${P}-${PR}.pkginfo" ] && . "${P}-${PR}.pkginfo"
> 
>   src_install() {
>     eval_pkgnames
>     cd ${B}
>     make install INSTALL_PREFIX=${D}
>     [...]

This workaround works fine if I call

  $ cygport <pkgname> install
  $ cygport <pkgname> package

but it does not work if I call

  $ cygport <pkgname> install package
or
  $ cygport <pkgname> install almostall

Even if I add a

  . "${P}-${PR}.pkginfo"

right after the call to eval_pkgnames in src_install(), the values of
the variables set in that file are lost to the install stage.

Therefore it would be nice if we could get some official method to
set package-relevant variables in a pre-package stage, like I asked
for in my original mail:

> > If it's not possible, would it make sense to add the ability to create
> > a src_package() function which could be used to create variable package
> > names or to add other pre-package steps?

What do you think?


Thanks,
Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]