From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 942CD198005 for ; Sat, 23 Mar 2013 20:54:14 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 3EE41E07C6; Sat, 23 Mar 2013 20:54:10 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 41838E07A8 for ; Sat, 23 Mar 2013 20:54:09 +0000 (UTC) Received: from [192.168.4.5] (blfd-4db0e01a.pool.mediaWays.net [77.176.224.26]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: hasufell) by smtp.gentoo.org (Postfix) with ESMTPSA id 2EDAE33DB69; Sat, 23 Mar 2013 20:54:01 +0000 (UTC) Message-ID: <514E1667.8030604@gentoo.org> Date: Sat, 23 Mar 2013 21:53:59 +0100 From: hasufell User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130314 Thunderbird/17.0.4 Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@lists.gentoo.org Reply-to: gentoo-dev@lists.gentoo.org MIME-Version: 1.0 To: gentoo-dev@lists.gentoo.org CC: games@gentoo.org, mgorny@gentoo.org, ryao@gentoo.org Subject: [gentoo-dev] New eclass: games-bin (review/comments) X-Enigmail-Version: 1.5 Content-Type: multipart/mixed; boundary="------------070404010307080503020101" X-Archives-Salt: 1d3c5af4-04cc-43f9-a19f-dc129d7dc632 X-Archives-Hash: 0ac6900ffd6da10a8fb9ddfa8d889755 This is a multi-part message in MIME format. --------------070404010307080503020101 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 After packaging the complete humble bundle last time I noticed a bit of code duplication. Nothing serious, but I still think there could be a small eclass making things easier. Especially the "remove_bundled_libs" function and the is useful IMO and allows to easily remove those things. The GAMES_PRESERVE_BUNDLED_LIBS array would allow to preserve libs, e.g. stuff like "libbass" which is not present in the tree and even GAMES_PRESERVE_BUNDLED_LIBS_amd64 (in case we have a 32bit only game and there are no multilib versions for some of those libs). It also works well with a "bundled-libs" useflag (see games-bin_src_prepare), because it can happen that binary games break while the tree is moving forward with library versions, or that system libraries create weird blockers for the user or even cause runtime breakage (which happened with the editor of games-rpg/grimrock wrt #454934). Most bin games use some functions from unpacker.eclass, so it is inherited and used in games-bin_src_unpack by default. I was also thinking about some check-reqs thing, but it's probably better that is handled explicitly. If you have suggestions or if you think that approach sucks, please tell me. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBAgAGBQJRThZnAAoJEFpvPKfnPDWzl8EH/RARdOR2GKicEBGTxO2krO1A AUcHcUlqjkgwaDmNcJ4HwbEhgVJG6vojNDihKJixlJShkD51tsVP/mhBzReH9zkE RC7mBCek/uB5NrH5Vm2C1/dtBWAuxjJ2mN3a327a7U2tPcHkgYBGZtiAI7pSS8cl UCfr315wBYPO95LZDUiuoQHw+ogzDP7RsrNhlJKHgwXJLE2oEUrtoKo3rkDwDZlU ODVYT95sfZAHkyQDGhTusZB8Go+2+hhUHUua0yG30m4PXiW6j/4kCHYV59HRHYsj 6uEKpX4/h7xU0MZ1bOpqZHK2CoNlL7lPdxOMpQ/rVw8eyRNVuDpkyT1YkD/Rnj4= =uaH2 -----END PGP SIGNATURE----- --------------070404010307080503020101 Content-Type: text/plain; charset=UTF-8; name="games-bin.eclass" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="games-bin.eclass" # Copyright 1999-2013 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ # @ECLASS: games-bin.eclass # @MAINTAINER: # Julian Ospald # games herd # @BLURB: games eclass for binary games such as humble bundle sales # @DESCRIPTION: # RESTRICT, GAMES_DIR, QA_PREBUILT and S are preset, but can be overridden # as usual when set after the inherit line (see "ECLASS DEFAULTS"). # E.g. GAMES_DIR var is preset to ${GAMES_PREFIX_OPT}/${PN} and can be used # in src_install. # # remove_bundled_libs is executed automatically in games-bin_src_prepare # if IUSE="bundled-libs" is present and if the user has disabled it. # Use GAMES_PRESERVE_BUNDLED_LIBS array to always preserve particular # libraries, e.g. when they are not in the tree. inherit unpacker games EXPORT_FUNCTIONS pkg_nofetch src_unpack src_prepare # ECLASS DEFAULTS RESTRICT="bindist fetch" GAMES_DIR="${GAMES_PREFIX_OPT}/${PN}" QA_PREBUILT="${GAMES_DIR#/}/*}" S=${WORKDIR} # @ECLASS-VARIABLE: GAMES_DIR # @DESCRIPTION: # Install dir to be used with insinto/doins, # default is: ${GAMES_PREFIX_OPT}/${PN}. # @ECLASS-VARIABLE: GAMES_PRESERVE_BUNDLED_LIBS # @DESCRIPTION: # Preserve list for bundled libraries, must be a bash ARRAY! # Supports wildcard (libGLEW.so*), but only filenames, not paths. # Supports _$ARCH suffix for the var (GAMES_PRESERVE_BUNDLED_LIBS_amd64). # @FUNCTION: remove_bundled_libs # @USAGE: [] # @DESCRIPTION: # Looks recursively for libraries and symlinks matching # lib*.so* in (default is ${S}) and removes them. remove_bundled_libs() { local p i x local dir=${1:-${S}} # default search pattern for "find" local search_pattern=(-name "lib*.so*") einfo "Removing bundled libraries" for p in GAMES_PRESERVE_BUNDLED_LIBS{,_${ARCH}} ; do if [[ "$(declare -p ${p} 2>/dev/null 2>&1)" == "declare -a"* ]]; then x=${p}[@] # preserve the array for i in "${!x}" ; do # no paths, use ${1} instead for micro-management [[ ${i} == */* ]] && die "GAMES_PRESERVE_BUNDLED_LIBS must not contain paths" # add exclusions to the search pattern search_pattern+=( -a \! -name "${i}") done fi done find "${dir}" \( -type f -o -type l \) \( "${search_pattern[@]}" \) -print -delete || die } games-bin_pkg_nofetch() { einfo einfo "Please buy & download ${SRC_URI} from:" einfo " ${HOMEPAGE}" einfo "and move it to ${DISTDIR}" einfo } games-bin_src_unpack() { unpacker_src_unpack } games-bin_src_prepare() { if has bundled-libs ${IUSE} ; then use bundled-libs || remove_bundled_libs fi } --------------070404010307080503020101--