pylm
(usa Gentoo)
Enviado em 25/11/2018 - 10:00h
Eu sou um zero a esquerda em shell script mas acho os PKGBUILDs bem fáceis de ler, na verdade são o mais fácil possível dentro da proposta, saca só esse:
# Maintainer: Robin Lange <robin dot langenc at gmail dot com>
# Contributor: Robin Lange <robin dot langenc at gmail dot com>
pkgname=optimus-manager
pkgver=0.4
pkgrel=2
pkgdesc="Management utility to handle GPU switching for Optimus laptops."
arch=('any')
url="https://github.com/Askannz/optimus-manager"
license=('MIT')
depends=('python' 'python-setuptools' 'bbswitch' 'xorg-xrandr')
makedepends=('python-setuptools')
backup=('etc/optimus-manager/optimus-manager.conf'
'etc/optimus-manager/xorg-intel.conf'
'etc/optimus-manager/xorg-nvidia.conf')
source=("git+https://github.com/Askannz/optimus-manager.git#tag=v$pkgver")
sha256sums=('SKIP')
build() {
cd "${srcdir}/optimus-manager/"
python setup.py build
}
package() {
cd "${srcdir}/optimus-manager/"
install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
install -Dm644 modules/optimus-manager.conf "$pkgdir/etc/modprobe.d/optimus-manager.conf"
install -Dm755 xorg/optimus-manager_Xsetup "$pkgdir/usr/bin/optimus-manager_Xsetup"
install -Dm644 systemd/optimus-manager.service "$pkgdir/usr/lib/systemd/system/optimus-manager.service"
install -Dm644 systemd/99-optimus-manager.conf "$pkgdir/usr/lib/systemd/system/display-manager.service.d/99-optimus-manager.conf"
install -Dm644 optimus-manager.conf "$pkgdir/usr/share/optimus-manager.conf"
install -Dm644 config/xorg-intel.conf "$pkgdir/etc/optimus-manager/xorg-intel.conf"
install -Dm644 config/xorg-nvidia.conf "$pkgdir/etc/optimus-manager/xorg-nvidia.conf"
mkdir -p "$pkgdir/var/lib/optimus-manager/"
python setup.py install --root="$pkgdir/" --optimize=1 --skip-build
}
O formato é bem organizado, da informações do pacote, local de onde vai ser feito o download, arquivos que vão ser backupeados e como vai ser feita a instalação.
Agora olha só um ebuild, que tem basicamente a mesma proposta de um pkgbuild:
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
EAPI=5
inherit eutils multilib readme.gentoo systemd user
DESCRIPTION="Service providing elegant and stable means of managing Optimus graphics chipsets"
HOMEPAGE="https://bumblebee-project.org https://github.com/Bumblebee-Project/Bumblebee" ;
SRC_URI="https://bumblebee-project.org/${P}.tar.gz"
SLOT="0"
LICENSE="GPL-3"
KEYWORDS="amd64 x86"
IUSE="+bbswitch video_cards_nouveau video_cards_nvidia"
RDEPEND="
dev-libs/libbsd
virtual/opengl
x11-base/xorg-drivers[video_cards_nvidia?,video_cards_nouveau?]
x11-misc/virtualgl:=
bbswitch? ( sys-power/bbswitch )
"
DEPEND="${RDEPEND}
dev-libs/glib:2
sys-apps/help2man
virtual/pkgconfig
x11-libs/libX11
"
REQUIRED_USE="|| ( video_cards_nouveau video_cards_nvidia )"
src_prepare() {
epatch_user
}
src_configure() {
DOC_CONTENTS="In order to use Bumblebee, add your user to 'bumblebee' group.
You may need to setup your /etc/bumblebee/bumblebee.conf"
if use video_cards_nvidia ; then
# Get paths to GL libs for all ABIs
local nvlib=""
for i in $(get_all_libdirs) ; do
nvlib="${nvlib}:/usr/${i}/opengl/nvidia/lib"
done
local nvpref="/usr/$(get_libdir)/opengl/nvidia"
local xorgpref="/usr/$(get_libdir)/xorg/modules"
ECONF_PARAMS="CONF_DRIVER=nvidia CONF_DRIVER_MODULE_NVIDIA=nvidia \
CONF_LDPATH_NVIDIA=${nvlib#:} \
CONF_MODPATH_NVIDIA=${nvpref}/lib,${nvpref}/extensions,${xorgpref}/drivers,${xorgpref}"
fi
econf \
--docdir=/usr/share/doc/"${PF}" \
${ECONF_PARAMS}
}
src_install() {
newconfd "${FILESDIR}"/bumblebee.confd bumblebee
newinitd "${FILESDIR}"/bumblebee.initd bumblebee
newenvd "${FILESDIR}"/bumblebee.envd 99bumblebee
systemd_dounit scripts/systemd/bumblebeed.service
readme.gentoo_create_doc
default
}
pkg_preinst() {
use video_cards_nvidia || rm "${ED}"/etc/bumblebee/xorg.conf.nvidia
use video_cards_nouveau || rm "${ED}"/etc/bumblebee/xorg.conf.nouveau
enewgroup bumblebee
}
Já tem bem mais operações e honestamente eu não consigo ler tudo.