void-packages/srcpkgs/sublime-text3-bin/template

56 lines
1.8 KiB
Bash

# Template file for 'sublime-text3-bin'
pkgname=sublime-text3-bin
version=3211
revision=1
archs="i686 x86_64"
wrksrc="sublime_text_3"
hostmakedepends="w3m"
depends="libpng gtk+ hicolor-icon-theme desktop-file-utils"
short_desc="Sophisticated text editor for code, markup and prose"
maintainer="Andrea Brancaleoni <miwaxe@pompel.me>"
license="custom:EULA"
homepage="http://www.sublimetext.com/3dev"
_license_checksum=33929b71625d13dacf2a0a5853171b9c04058f71e2955ee660b8d0f8dda45ed1
repository="nonfree"
restricted=yes
nopie=yes
replaces="sublime-text3>0"
if [ "$XBPS_TARGET_MACHINE" = "x86_64" ]; then
distfiles="https://download.sublimetext.com/sublime_text_3_build_${version}_x64.tar.bz2"
checksum=0b3c8ca5e6df376c3c24a4b9ac2e3b391333f73b229bc6e87d0b4a5f636d74ee
else
distfiles="https://download.sublimetext.com/sublime_text_3_build_${version}_x32.tar.bz2"
checksum=480609962bbbd12128b5332c7831372b8851c13e160512730d1b0a6a835a3071
fi
post_extract() {
$XBPS_FETCH_CMD https://www.sublimehq.com/eula
sed -n '
/is licensed.*not sold/p
/<ol>/,${ /<\/ol>/{x;p;d}; H }
$a </ol>
' <eula | w3m -dump -I utf-8 -T text/html >EULA
filesum="$(xbps-digest EULA)"
if [ "$filesum" != "$_license_checksum" ]; then
msg_error "SHA256 mismatch for EULA:\n$filesum\n"
fi
}
do_install() {
vmkdir "usr/bin"
vmkdir "usr/lib/sublime_text"
cp --preserve=mode -r ./* "${DESTDIR}/usr/lib/sublime_text"
vinstall "sublime_text.desktop" 644 "usr/share/applications/"
for size in 128 16 256 32 48; do
vinstall "Icon/${size}x${size}/sublime-text.png" 644 \
"usr/share/icons/hicolor/${size}x${size}/apps/"
done
ln -s /usr/lib/sublime_text/sublime_text ${DESTDIR}/usr/bin/subl3
vsed -e 's:Exec=/opt/sublime_text/:Exec=/usr/lib/sublime_text/:' \
-i ${DESTDIR}/usr/share/applications/sublime_text.desktop
vlicense EULA
}