diff options
Diffstat (limited to 'system/vice/vice.SlackBuild')
-rw-r--r-- | system/vice/vice.SlackBuild | 376 |
1 files changed, 269 insertions, 107 deletions
diff --git a/system/vice/vice.SlackBuild b/system/vice/vice.SlackBuild index 43c1de7bc4..38aa08d8c5 100644 --- a/system/vice/vice.SlackBuild +++ b/system/vice/vice.SlackBuild @@ -1,32 +1,69 @@ -#!/bin/sh - -# Slackware build script for VICE - -# Copyright 2008 Mauro Giachero (mauro dot giachero at gmail dot com) -# All rights reserved. -# -# Redistribution and use of this script, with or without modification, is -# permitted provided that the following conditions are met: -# -# 1. Redistributions of this script must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR IMPLIED -# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO -# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; -# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR -# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -# Initialize variables +#!/bin/bash + +# Slackware build script for vice + +# Copyright 2008 Mauro Giachero (email removed) +# Copyright 2020, 2021, 2022, 2023 B. Watson (urchlay@slackware.uk) + +# Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details. + +# 20240213 bkw: update for v3.8. +# - had to add --disable-parsid to the configure command. it was breaking +# the build. also, do you really have a SID chip connected to your +# parallel port? (do you even *have* a parallel port?)... if so, either +# send me a patch, or wait until upstream does another release. +# - LAME is no longer supported, remove --enable-lame. +# - add --enable-catweasel. + +# 20230504 bkw: BUILD=2. +# - fix vice.texi so the GNU info file gets generated. +# - remove old ./configure arguments and fix a couple of wrong ones. +# thanks to Franzen for sending a patch to fix this. +# - changed -Wl,--allow-multiple-definition to -fcommon, which does +# basically the same thing but matches how other builds do it. +# - fix doinst.sh silliness. +# - add douninst.sh, to clean up /usr/info/dir after the package is removed. + +# 20221228 bkw: update for v3.7.1. + +# 20221129 bkw: update for v3.6.1. +# - can't build our own HTML or plaintext docs from vice.texi. +# - include upstream's HTML docs in package. + +# 20210809 bkw: update for v3.5, many changes, can't build old versions. +# - Relicense as WTFPL, with permission from the original author. +# - Build & install the actual HTML docs (not the bundled copy of +# the upstream website). +# - Don't install fonts. They were part of the above. +# - Use upstream's .desktop files instead of our own. +# - Upstream removed the man pages; restore them (for now). +# - Build the gtk+3 UI. Also build the SDL2 UI, unless the user's +# requested the SDL1 one (or disabled SDL). +# - Really fix the paths in the documentation. +# - ffmpeg now included in Slackware (pre-15.0 -current). Still +# autodetected, but the docs no longer mention it. +# - Get rid of README_SBo.txt as the build options are simpler +# and "fit" in the regular README now. + +# 20200801 bkw: +# - Take over maintenance +# - Autodetect ffmpeg +# - Allow building with SDL 1.x +# - Allow building without pulseaudio +# - Get rid of xa dep +# - Install TTF fonts in correct place, get rid of other formats +# - install-info in doinst.sh so vice.info shows up in the info dir +# - Have slack-desc show build options +# - Re-enable the old x64 emulator +# - BUILD=3 + +cd $(dirname $0) ; CWD=$(pwd) + PRGNAM=vice -VERSION=${VERSION:-3.3} +VERSION=${VERSION:-3.8} BUILD=${BUILD:-1} TAG=${TAG:-_SBo} +PKGTYPE=${PKGTYPE:-tgz} if [ -z "$ARCH" ]; then case "$( uname -m )" in @@ -36,7 +73,11 @@ if [ -z "$ARCH" ]; then esac fi -CWD=$(pwd) +if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then + echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE" + exit 0 +fi + TMP=${TMP:-/tmp/SBo} PKG=$TMP/package-$PRGNAM OUTPUT=${OUTPUT:-/tmp} @@ -58,102 +99,223 @@ else LIBDIRSUFFIX="" fi -# Only an external ffmpeg seems to work ATM (might change from version to version) -if [ "${FFMPEG:-no}" = "yes" ]; then ffmpeg="--enable-external-ffmpeg"; else ffmpeg=""; fi - -# Exit if errors encountered set -e -# Setup for package creation +# ffmpeg is included in the base OS on post-14.2 -current, but leave +# this here in case someone's doing something clever. +[ -x /usr/bin/ffmpeg ] && ffmpeg="--enable-ffmpeg" + +# Anticipating 15.0's pure-alsa-system +# 20240214 bkw: which sadly never materialized. I keep this here for +# my own use, anyway. +if [ "${PULSE:-yes}" != "yes" ]; then + pulseopt="--without-pulse" +fi + +echo "=== pulseopt='$pulseopt'" + rm -rf $PKG mkdir -p $TMP $PKG $OUTPUT cd $TMP rm -rf $PRGNAM-$VERSION -tar xvf $CWD/$PRGNAM-$VERSION.tar.?z + +tar xvf $CWD/$PRGNAM-$VERSION.tar.gz + cd $PRGNAM-$VERSION chown -R root:root . -find -L . \ - \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 -o -perm 511 \) \ - -exec chmod 755 {} \; -o \ - \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \ - -exec chmod 644 {} \; +chmod 644 doc/html/fonts/OFL.txt # this file shouldn't be +x +find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \ + \! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+ -# Set proper paths in documentation. -sed -i "s/\/usr\/local\/lib\//\/usr\/lib${LIBDIRSUFFIX}\//g" \ - man/vice.1 -sed -i 's/"\/vice_toc\.html"/"\/html\/vice_toc\.html"/g' \ - src/arch/gtk3/uicommands.c -sed -i "s/\/usr\/local/\/usr/g" doc/vice.* doc/html/*html -sed -i "s/\/usr\/lib\//\/usr\/lib${LIBDIRSUFFIX}\//g" doc/vice.* doc/html/*html +# Fix some mildly broken constructs in vice.texi, so we can generate +# the vice.info doc. +patch -p1 < $CWD/fix_texi.diff -# Disable PDF generation because it bombs -sed -i "s/AM_CONDITIONAL(BUILD_PDF, true)/AM_CONDITIONAL(BUILD_PDF, false)/g" \ - configure.ac +DOCDIR=/usr/doc/$PRGNAM-$VERSION +PKGDOC=$PKG/$DOCDIR -# Don't install fonts in $HOME and run fc-cache on the build system -sed -i -e '/@HAVE_FC_CACHE_TRUE@/d' data/fonts/Makefile.am +# setting TEXMFVAR prevents writing to /root, which SlackBuilds +# really shouldn't do. +export TEXMFVAR=$( pwd )/.texmf-var +# Set proper paths in documentation. +rm -rf doc/vice.pdf # will be rebuilt, along with the HTML doc. +sed -i -e "s/\/usr\/local/\/usr/g" \ + -e "s,/lib/vice/,/share/vice/,Ig" \ + doc/vice.texi autoreconf -vif -# Configure the software -CFLAGS="$SLKCFLAGS" \ -CXXFLAGS="$SLKCFLAGS" \ -./configure \ - --prefix=/usr \ - --libdir=/usr/lib${LIBDIRSUFFIX} \ - --sysconfdir=/etc \ - --localstatedir=/var \ - --mandir=/usr/man \ - --infodir=/usr/info \ - $ffmpeg \ - --docdir=/usr/doc/$PRGNAM-$VERSION \ - --with-x \ - --enable-quicktime \ - --enable-ethernet \ - --enable-parsid \ - --enable-cpuhistory \ - --build=$ARCH-slackware-linux - -# Build the software +# We build up to 3 times with slightly different ./configure args, +# so make it a function. +config() { + local configarg="$1" + + # Avoid the need for xa. It's only used to generate a small C header + # file, which we include a prebuilt version of here. There's nothing + # dynamic about this header, it's just a small chunk of 6502 object + # code as a C array, and for a given version of vice it'll always be + # the same code. It didn't change between vice 3.4 and 3.5, either. + cat $CWD/psiddrv.h.prebuilt.3.4 > src/c64/psiddrv.h + + # 20210809 bkw: in 3.5, upstream added dos2unix as a required dep, + # but it's *only used* if you run "make dist" or "make dist-gzip", + # which we don't do. DOS2UNIX=/bin/true bypasses the autodetection. + # XDG_DESKTOP_MENU=/bin/true prevents installing .desktop files, + # because those don't respect $DESTDIR. We can't just disable them + # with a configure argument, because that stops them being built + # at all. + + # 20230504 bkw: note to self: -w means disable all warnings. + CFLAGS="$SLKCFLAGS -w -fcommon" \ + CXXFLAGS="$SLKCFLAGS" \ + DOS2UNIX=/bin/true \ + XA=/bin/true \ + XDG_DESKTOP_MENU=/bin/true \ + ./configure \ + $configarg \ + $ffmpeg \ + $pulseopt \ + --enable-html-docs \ + --enable-platformdox \ + --enable-x64 \ + --enable-x64-image \ + --prefix=/usr \ + --libdir=/usr/lib${LIBDIRSUFFIX} \ + --sysconfdir=/etc \ + --localstatedir=/var \ + --mandir=/usr/man \ + --infodir=/usr/info \ + --docdir=$DOCDIR \ + --enable-ethernet \ + --disable-parsid \ + --enable-cpuhistory \ + --with-mpg123 \ + --with-flac \ + --with-vorbis \ + --with-gif \ + --with-png \ + --enable-midi \ + --enable-catweasel \ + --build=$ARCH-slackware-linux + + make +} + +# SDL UI: *Only* build/install the binaries (not the docs or ROMs), +# rename them to <whatever>-sdl2 (or -sdl1). +buildsdl() { + local exesuf="-sdl$1" + local configarg="--disable-pdf-docs --enable-sdl${1}ui" + + config "$configarg" + make -C src install-binPROGRAMS \ + DESTDIR="$PKG" \ + EXEEXT="$exesuf" \ + INSTALL_PROGRAM="install -s -m0755" + + # get rid of the non-graphical tools (the gtk3 build will + # install them again without -$exesuf). + rm -f $PKG/usr/bin/[cp]*$exesuf + + make distclean +} + +# Build the SDL binaries, unless disabled. +# Be generous in what we accept for SDL in the env. "both" isn't +# mentioned in README, it's probably only useful to me. +case "${SDL:-2}" in + ""|2*|y*|Y*|t*|T*) buildsdl 2 ;; + 1*) buildsdl 1 ;; + both) buildsdl 1 ; buildsdl 2 ;; + n*|N*|f*|F*|0*) ;; # NOP + *) cat <<EOF + +*** +$0: invalid value for SDL environment variable. +Allowed values: "1", "2", "no", "both", or empty/unset (same as "2"). +*** +EOF + exit 1 ;; +esac + +# Now build & install the whole project with the gtk3 UI. +config "--enable-gtk3ui --enable-desktop-files" make -make install DESTDIR=$PKG - -# Strip symbols from binaries -find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \ - | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true - -find $PKG/usr/man -type f -exec gzip -9 {} \; -for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done - -# Compress info files -rm -f $PKG/usr/info/dir -gzip -9 $PKG/usr/info/* - -# Install icon and menu entries -mkdir -p $PKG/usr/share/{applications,pixmaps} -install -D -m 0644 $CWD/config/*.desktop $PKG/usr/share/applications -install -D -m 0644 $CWD/config/vice.png $PKG/usr/share/pixmaps - -# Move the original documentation folder to the usual place -# and create a link to where vice expect it to be -mkdir -p $PKG/usr/doc -mv $PKG/usr/lib$LIBDIRSUFFIX/$PRGNAM/doc $PKG/usr/doc/$PRGNAM-$VERSION -( cd $PKG/usr/doc/$PRGNAM-$VERSION - chmod 644 * - mkdir html - mv *.html *.png *.gif *.css html/ ) -( cd $PKG/usr/lib$LIBDIRSUFFIX/$PRGNAM ; ln -s /usr/doc/$PRGNAM-$VERSION doc ) - -# Copy additional program documentation -cp -a AUTHORS ChangeLog COPYING FEEDBACK INSTALL NEWS README \ - $PKG/usr/doc/$PRGNAM-$VERSION -cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild - -# Setup package install directory +make install-strip DESTDIR=$PKG + +# 20240214 bkw: in 3.8, 'make install' no longer installs any of +# the docs. Do it manually. Leave out building/ (we don't need to +# care about building on fedora, windows, mac OS). +mkdir -p $PKGDOC +cp -a doc/*.txt $PKGDOC + +# Install desktop files manually. +mkdir -p $PKG/usr/share/desktop-directories \ + $PKG/usr/share/applications +install -m0644 src/arch/gtk3/data/unix/vice*desktop \ + $PKG/usr/share/applications +install -m0644 src/arch/gtk3/data/unix/vice*directory \ + $PKG/usr/share/desktop-directories + +# Documentation. vice.pdf has already been installed to the doc dir. +# Generate info, plaintext, and HTML versions here. The text doc is +# harder to navigate, but easier to grep, so it's worth having IMO. +# 20221130 bkw: vice.texi no longer works with makeinfo, as of +# vice-3.6.1. Not sure whether this is because we have an +# outdated texinfo package in Slackware 15.0, or because upstream +# broke some kind of rule... regardless, it's disabled for now. +# 20230504 bkw: Patched vice.texi, so this is now enabled by default. +if [ "${MAKEINFO:-yes}" = "yes" ]; then + makeinfo doc/$PRGNAM.texi + mkdir -p $PKG/usr/info + mv $PRGNAM.info* $PKG/usr/info + gzip -9 $PKG/usr/info/* + + makeinfo --plaintext doc/$PRGNAM.texi > $PKGDOC/$PRGNAM.txt +fi + +# 20221130 bkw: HTML docs do get built, but never installed. +mkdir -p $PKGDOC/html +cp -a doc/html/{NEWS,COPYING,fonts/,images/,*.{html,css,ico}} $PKGDOC/html +ln -s html/NEWS $PKGDOC/NEWS +ln -s html/COPYING $PKGDOC/COPYING + +# 20210810 bkw: as of 3.5, upstream dropped the man pages. I'm +# including the man pages from 3.4 in the 3.5 package. Edited them +# slightly to add correct paths to the HTML and PDF docs, also +# convert the iso-8859-1 characters into troff escapes. Also +# added (and expanded) vsid.1 from Debian. +mkdir -p $PKG/usr/man/man1 +for i in $CWD/man/*.?; do + sed -e "s,@HTMLDOC@,$DOCDIR/html/index.html," \ + -e "s,@PDFDOC@,$DOCDIR/$PRGNAM.pdf," \ + < $i > $PKG/usr/man/man1/$( basename $i ) +done +gzip -9 $PKG/usr/man/man?/*.? +for i in x64 x64sc xscpu64 x64dtv x128 xvic xpet xplus4 xcbm2 xcbm5x0; do + ln -s vice.1.gz $PKG/usr/man/man1/$i.1.gz +done + +cp -a NEWS README $PKGDOC +cat $CWD/$PRGNAM.SlackBuild > $PKGDOC/$PRGNAM.SlackBuild + +# Make the slack-desc reflect the build options. +PA=no +if [ "$SDL" = "both" ]; then + SDL="1.2 and 2.0" +else + SDL=no + [ -x $PKG/usr/bin/x128-sdl1 ] && SDL=1.2 + [ -x $PKG/usr/bin/x128-sdl2 ] && SDL=2.0 +fi +grep -q '^#define USE_PULSE\>' src/config.h && PA=yes + mkdir -p $PKG/install -cat $CWD/slack-desc > $PKG/install/slack-desc +sed -e "s,@PA@,$PA," \ + -e "s,@SDL@,$SDL," \ + $CWD/slack-desc > $PKG/install/slack-desc cat $CWD/doinst.sh > $PKG/install/doinst.sh +cat $CWD/douninst.sh > $PKG/install/douninst.sh -# Create package cd $PKG -/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz} +/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE |