From 0652e3a67a9f11bceb545cf1ce335ce8a211df2d Mon Sep 17 00:00:00 2001 From: Dustin Polke Date: Wed, 23 May 2012 13:40:45 +0200 Subject: Rework cairo-dock.eclass. - Adapt to new upstream versioning theme. - Drop unused variables. - Rework CMakeLists.txt handling. - Fix some typos. --- eclass/ChangeLog | 9 +++++ eclass/cairo-dock.eclass | 102 ++++++++++++++++++++++++++--------------------- 2 files changed, 66 insertions(+), 45 deletions(-) diff --git a/eclass/ChangeLog b/eclass/ChangeLog index e1c74bc..d9ec826 100644 --- a/eclass/ChangeLog +++ b/eclass/ChangeLog @@ -2,6 +2,15 @@ # Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2 # $Header$ + 23 May 2012; Dustin Polke cairo-dock.eclass: + - Adapt to new upstream versioning scheme (only 3 digits now). + - Drop unneeded variables. + - Restructure CMakeLists.txt handling. + - Fix some typos. + + 23 May 2012; Dustin Polke cairo-dock.eclass: + Update email address. + 25 Apr 2012; Dustin Polke cairo-dock.eclass: Unpack cmake_modules for all plugins as with cairo-dock-3.0.0 it is always needed. diff --git a/eclass/cairo-dock.eclass b/eclass/cairo-dock.eclass index 541b979..17c6b40 100644 --- a/eclass/cairo-dock.eclass +++ b/eclass/cairo-dock.eclass @@ -4,10 +4,10 @@ # @ECLASS: cairo-dock.eclass # @MAINTAINER: -# dustin.polke@uni-siegen.de +# DuPol@gmx.de # # @CODE@ -# Authors: Dustin Polke . +# Authors: Dustin Polke . # @CODE@ # @BLURB: Helper eclass for cairo-dock installation. # @DESCRIPTION: @@ -15,55 +15,57 @@ inherit versionator -# @ECLASS-VARIABLE: CD_P +# @ECLASS-VARIABLE: CDP_CMakeLists_FORCE_UNPACK # @DESCRIPTION: -# Upstream's name of the package -: ${CD_P:=${PN}-$(replace_version_separator 3 '~' )} +# Force unpacking of CMakeLists.txt for cairo-dock-plugins if not set to "0". +: ${CDP_CMakeLists_FORCE_UNPACK:=0} # @ECLASS-VARIABLE: CDP_P # @INTERNAL # @DESCRIPTION: # Upstream's name of the plugin package -: ${CDP_P:=${PN%-*}-$(replace_version_separator 3 '~' )} +: ${CDP_P:=${PN%-*}-${PV}} CDP_P=${CDP_P/cd/cairo-dock} -# @ECLASS-VARIABLE: CD_PV_MAJ_MIN -# @INTERNAL -# @DESCRIPTION: -# Major and minor numbers of the version number. -: ${CD_PV_MAJ_MIN:=$(get_version_component_range 1-2)} - -# @ECLASS-VARIABLE: CD_PV_MAJ_MIN_MIC -# @INTERNAL -# @DESCRIPTION: -# Major, minor, and micro numbers of the version number. -: ${CD_PV_MAJ_MIN_MIC:=$(get_version_component_range 1-3)} - # @ECLASS-VARIABLE: CD_TYPE # @INTERNAL # @DESCRIPTION: # Defines package type. if [ "${CDP_P%-*}" == "cairo-dock-plugins" ]; then CD_TYPE="plug-ins" - CD_P="${CDP_P}" else CD_TYPE="core" fi +# @ECLASS-VARIABLE: CD_P +# @DESCRIPTION: +# Upstream's name of the package +if [ "${CD_TYPE}" == "plug-ins" ]; then + : ${CD_P:=${CDP_P}} +else + : ${CD_P:=${PN}-${PV}} +fi + +# @ECLASS-VARIABLE: CD_PV_MAJ_MIN +# @INTERNAL +# @DESCRIPTION: +# Major and minor numbers of the version number. +: ${CD_PV_MAJ_MIN:=$(get_version_component_range 1-2)} + # @ECLASS-VARIABLE: CD_PLUGINS # @DESCRIPTION: # Names of all plugins to be handled by the ebuild. -SRC_URI="http://launchpad.net/cairo-dock-${CD_TYPE}/${CD_PV_MAJ_MIN}/${CD_PV_MAJ_MIN_MIC}/+download/${CD_P}.tar.gz" +SRC_URI="http://launchpad.net/cairo-dock-${CD_TYPE}/${CD_PV_MAJ_MIN}/${PV}/+download/${CD_P}.tar.gz" S="${WORKDIR}"/${CD_P} # @FUNCTION: cairo-dock_src_unpack # @DESCRIPTION: -# For plugins, unpack only code for plugins to be build; otherwise run -# default_src_unpack. -# Don't unpack CMakeLists.txt if ${FILESDIR}/${P}-CMakeLists.txt or -# ${FILESDIR}/${PN}-${CD_PV_MAJ_MIN_MIC}-CMakeLists.txt exist. +# For cairo-dock, run default_src_unpack. +# For plugins, unpack only code for plugins to be build; there needs to be +# either ${P}-CMakeLists.txt or ${PN}-${CD_PV_MAJ_MIN}-CMakeLists.txt in +# ${FILESDIR}. cairo-dock_src_unpack() { if [ "${CD_TYPE}" == "plug-ins" ]; then local target targets=( "${CDP_P}/cmake_modules" ) @@ -72,34 +74,47 @@ cairo-dock_src_unpack() { for target in ${CD_PLUGINS[@]}; do targets+=( "${CDP_P}/${target}" ) done - [ ! -f "${FILESDIR}"/${PN}-${CD_PV_MAJ_MIN_MIC}-CMakeLists.txt -a \ - ! -f "${FILESDIR}"/${P}-CMakeLists.txt ] && + [ "${CDP_CMakeLists_FORCE_UNPACK}" != "0" ] && \ targets+=( "${CDP_P}/CMakeLists.txt" ) - einfo tar xzf "${DISTDIR}"/${CDP_P}.tar.gz ${targets[@]} - tar xzf "${DISTDIR}"/${CDP_P}.tar.gz ${targets[@]} || die + ebegin "Unpacking parts of ${CDP_P}.tar.gz:" ${targets[@]//${CDP_P}\/} + tar -xzf "${DISTDIR}"/${CDP_P}.tar.gz ${targets[@]} + eend $? || die "Failed to unpack" else default_src_unpack fi } -# @FUNCTION: cairo-dock_src_unpack +# @FUNCTION: cairo-dock_src_prepare # @DESCRIPTION: -# Apply CMakeLists.patch if it exists, and use ${FILESDIR}/${P}-CMakeLists.txt -# or ${FILESDIR}/${PN}-${CD_PV_MAJ_MIN_MIC}-CMakeLists.txt if they exit. -# Enable verbose building. +# For cairo-dock, apply CMakeLists.patch if it exists. +# For plugins, use ${P}-CMakeLists.txt or ${PN}-${CD_PV_MAJ_MIN}-CMakeLists.txt +# (in this order) if any exist in ${FILESDIR}; die if no CMakeLists.txt has been +# made available. cairo-dock_src_prepare() { - if [ -f "${FILESDIR}"/${P}-CMakeLists.patch ]; then - epatch "${FILESDIR}"/${P}-CMakeLists.patch + if [ "${CD_TYPE}" == "plug-ins" ]; then + if [ "${CDP_CMakeLists_FORCE_UNPACK}" == "0" ]; then + if [ -f "${FILESDIR}"/${P}-CMakeLists.txt ]; then + ebegin "Using ${P}-CMakeLists.txt in '${FILESDIR}'" + cp {"${FILESDIR}"/${P}-,"${S}"/}CMakeLists.txt + eend $? || die + elif [ -f "${FILESDIR}"/${PN}-${CD_PV_MAJ_MIN}-CMakeLists.txt ]; then + ebegin "Using ${PN}-${CD_PV_MAJ_MIN}-CMakeLists.txt in '${FILESDIR}'" + cp {"${FILESDIR}"/${PN}-${CD_PV_MAJ_MIN}-,"${S}"/}CMakeLists.txt + eend $? || die + ebegin "Adjusting version to ${PV}" + sed -e "s/@CD_VER@/${PV}/" -i "${S}"/CMakeLists.txt + eend $? || die + else + die "No CMakeLists.txt made available" + fi + fi else - if [ -f "${FILESDIR}"/${P}-CMakeLists.txt ]; then - einfo "Copying ${P}-CMakeLists.txt from '${FILESDIR}'..." - cp {"${FILESDIR}"/${P}-,"${S}"/}CMakeLists.txt || die + if [ -f "${FILESDIR}"/${P}-CMakeLists.patch ]; then + epatch "${FILESDIR}"/${P}-CMakeLists.patch + elif [ -f "${FILESDIR}"/${PN}-${CD_PV_MAJ_MIN}-CMakeLists.patch ]; then + epatch "${FILESDIR}"/${PN}-${CD_PV_MAJ_MIN}-CMakeLists.patch else - einfo "Copying ${PN}-${CD_PV_MAJ_MIN_MIC}-CMakeLists.txt from '${FILESDIR}'..." - cp {"${FILESDIR}"/${PN}-${CD_PV_MAJ_MIN_MIC}-,"${S}"/}CMakeLists.txt || die - einfo "Adjusting version to $(replace_version_separator 3 '~' )..." - sed -e "s/@CD_VER@/$(replace_version_separator 3 '~' )/" \ - -i "${S}"/CMakeLists.txt + ewarn "CMakeLists.txt left unpatched" fi fi @@ -117,7 +132,4 @@ cairo-dock_src_prepare() { -i po/CMakeLists.txt || die fi fi - - # verbose building - mycmakeargs=( "-DCMAKE_VERBOSE_MAKEFILE=TRUE" ) } -- cgit v1.2.3-65-gdbad