This is the mail archive of the
cygwin-apps
mailing list for the Cygwin project.
Re: cygport: variable package names
- From: Corinna Vinschen <corinna-cygwin at cygwin dot com>
- To: cygwin-apps at cygwin dot com
- Date: Sun, 29 Apr 2012 20:20:29 +0200
- Subject: Re: cygport: variable package names
- References: <20120429135935.GB25385@calimero.vinschen.de>
- Reply-to: cygwin-apps at cygwin dot com
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}
[...]
> 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?
Corinna
--
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Project Co-Leader cygwin AT cygwin DOT com
Red Hat