From 142b4e3d0f6a48b5882799652f1241433ed65dc0 Mon Sep 17 00:00:00 2001 From: Ray-V Date: Mon, 11 Apr 2022 10:02:46 +0100 Subject: [PATCH] Revised koffice build for chalk/krita removed libpng-1.4 option added patch to prevent chalk/krita crashing when loading PNGs it has saved --- Apps/koffice-i18n/koffice-i18n.SlackBuild | 2 +- Apps/koffice/README | 15 +++- Apps/koffice/koffice.SlackBuild | 39 ++++------ BUILD-TDE.sh | 33 +++------ Misc/libpng/libpng.SlackBuild | 90 ----------------------- get-source.sh | 14 ---- 6 files changed, 36 insertions(+), 157 deletions(-) delete mode 100755 Misc/libpng/libpng.SlackBuild diff --git a/Apps/koffice-i18n/koffice-i18n.SlackBuild b/Apps/koffice-i18n/koffice-i18n.SlackBuild index 96a899c..c61849f 100755 --- a/Apps/koffice-i18n/koffice-i18n.SlackBuild +++ b/Apps/koffice-i18n/koffice-i18n.SlackBuild @@ -43,7 +43,7 @@ do cd $dir ## revert name 'chalk' to 'krita' if that has been done for koffice -[[ $(ls $INSTALL_TDE/lib64/*.so) == *krita* ]] && { +[[ $(ls $INSTALL_TDE/bin/krita) ]] && { echo -e "\n Reverting chalk to krita for $dir .. \n" ## Rename files and contents: mv ../template/messages/koffice/chalk.pot ../template/messages/koffice/krita.pot || true diff --git a/Apps/koffice/README b/Apps/koffice/README index f20682b..7f90c5f 100644 --- a/Apps/koffice/README +++ b/Apps/koffice/README @@ -1,7 +1,14 @@ -libpng14 is an optional build requirement for koffice. +Chalk/krita will crash trying to load PNGs it saved if it is built with libpng-1.6. -The source will be downloaded if selected with the koffice build, and on-line. +The patch included with the SlackBuild is a workaround until koffice issue 20 has been fixed. -Otherwise, download to the 'src' directory: -https://downloads.sourceforge.net/project/libpng/libpng14/1.4.22/libpng-1.4.22.tar.xz +If it is necessary to convert the image to the RGB working space, there are a number of profiles installed with {chalk,krita} in /share/apps/{chalk,krita}/profiles/ which can be installed with Imagemagick's 'convert', or GraphicsMagick's 'gm convert' + +Example: +""""""" +in=/original.png +out=/converted.png +profile=/share/apps/{chalk,krita}/profiles/srgb_color_space_profile.icm +convert='gm convert' +($convert $in -profile $profile $out) diff --git a/Apps/koffice/koffice.SlackBuild b/Apps/koffice/koffice.SlackBuild index 739091f..1a85d4e 100755 --- a/Apps/koffice/koffice.SlackBuild +++ b/Apps/koffice/koffice.SlackBuild @@ -28,32 +28,26 @@ VERSION=$TDEVERSION BUILD=${BUILD:-1} TAG=${TAG:-_tde} -## ignore this if pre-downloading sources -[[ $PRE_DOWNLOAD != yes ]] && { -## loading pngs saved/exported in chalk/krita crashes with libpng-1.6, so build with libpng-1.4 -[[ $(cat $TMPVARS/Krita_OPTS) == *libpng14* ]] && \ -[[ $(ls -l /usr/include/png.h) != *libpng14* ]] && { -## if libpng is linked to libpng16, set a marker to restore it after the build -[[ $(ls -l /usr/lib64/libpng.so) == *libpng16* ]] && touch $TMPVARS/Restore-libpng16 -## use the libpng14 library which is installed with the aaa_libraries package -ln -sf /usr/lib$LIBDIRSUFFIX/libpng14.so.14.22.0 /usr/lib$LIBDIRSUFFIX/libpng.so -## use the headers from the libpng-1.4 archive -ln -sf $TMP_BUILD/tmp-libpng/libpng-1.4.22/png.h /usr/include/png.h -ln -sf $TMP_BUILD/tmp-libpng/libpng-1.4.22/pngconf.h /usr/include/pngconf.h -## create libpng14.so if it doesn't exist -[[ ! -e /usr/lib$LIBDIRSUFFIX/libpng14.so ]] && { -ln -s /usr/lib$LIBDIRSUFFIX/libpng14.so.14.22.0 /usr/lib$LIBDIRSUFFIX/libpng14.so -## and set a marker to test after the build whether libpng14.so was created here -touch $TMPVARS/LPNG14so -} -} || true # exit 0 if libpng 1.4 is already installed as the system libpng -} - source ../../get-source.sh getsource_fn untar_fn +## Workaround to prevent chalk/krita crashing when loading PNGs it has saved +## Awaiting fix for koffice issue 20 +patch -p0 << EOF +--- filters/chalk/png/kis_png_converter.cpp ++++ filters/chalk/png/kis_png_converter.cpp +@@ -202,4 +202,7 @@ + // read all PNG info up to image data + png_read_info(png_ptr, info_ptr); ++#if PNG_LIBPNG_VER >= 10600 ++ png_set_invalid(png_ptr, info_ptr, PNG_INFO_iCCP); ++#endif + + // Read information about the png +EOF + ## fix chalk crashing - ## - set liblcms as a direct dependency - see issue 37 for details sed -i '23iKDE_CXXFLAGS = $(LCMS_LIBS)' chalk/Makefile.am @@ -140,9 +134,6 @@ $PRGNAM: makepkg_fn -## restore libpng16 links -[[ -e $TMPVARS/Restore-libpng16 ]] && libpng16_fn && rm $TMPVARS/Restore-libpng16 || true - ## restore libtqt-mt.la [[ $INSTALL_TDE == /usr ]] && \ { mv $TQTDIR/lib$LIBDIRSUFFIX/libtqt-mt.la-bak $TQTDIR/lib$LIBDIRSUFFIX/libtqt-mt.la 2>/dev/null || true diff --git a/BUILD-TDE.sh b/BUILD-TDE.sh index 0c72ea8..a566d6d 100755 --- a/BUILD-TDE.sh +++ b/BUILD-TDE.sh @@ -79,7 +79,6 @@ build_core() # These need to be set here: TMP=${TMP:-/tmp} -export LIBPNG_TMP=$TMP export BUILD_TDE_ROOT=$(pwd) # Place to build (TMP_BUILD), package (PKG), and output (OUTPUT) the program: @@ -445,7 +444,7 @@ ${app_2:-} ${about_2:-} ${status_2:-} ${comment_2:-} \ "Apps/knights" "A graphical chess interface" off "\Zb\Z6 \Zn" \ "Apps/knmap" "A graphical nmap interface" off "\Zb\Z6 Might need tdesudo \Zn" \ " Misc/GraphicsMagick" "Swiss army knife of image processing" off "\Zb\Z6 Buildtime option for chalk[krita] in koffice \Zn" \ -"Apps/koffice" "Office Suite" off "\Zb\Z6 Optional build-time dependencies - GraphicsMagick, libpng14 \Zn" \ +"Apps/koffice" "Office Suite" off "\Zb\Z6 Optional build-time dependency - GraphicsMagick \Zn" \ "Apps/koffice-i18n" "Internationalization files for koffice" off "\Zb\Z6 Provides \Zb\Z3Additional language support\Zb\Z6 for koffice \Zn" \ ${app_3:-} ${about_3:-} ${status_3:-} ${comment_3:-} \ ${app_4:-} ${about_4:-} ${status_4:-} ${comment_4:-} \ @@ -505,7 +504,7 @@ Do you want to read them? 10 75 [[ $? == 0 ]] && dialog --no-collapse --cr-wrap --no-shadow --colors --ok-label "Close" --msgbox \ " -$(cat $TMPVARS/READMEs)" \ +$(cat $TMPVARS/READMEs|sed "s||$(cat $TMPVARS/INSTALL_TDE)|")" \ 30 75 } @@ -629,21 +628,15 @@ done rm -f $TMPVARS/Krita_OPTS dialog --cr-wrap --nocancel --no-shadow --colors --title " Building chalk in koffice " --item-help --checklist \ " -There are three options that can be set up for building the imaging app. +There are two options that can be set for building the imaging app. [1] It is called \Zb\Z3chalk\Zn in TDE but was originally \Zb\Z3krita\Zn. -[2] .pngs saved from and loaded into chalk/krita will crash if it is built with libpng-1.6, but will load if libpng-1.4 is used. - Choosing \Zb\Z3libpng14\Zn here will unpack the libpng-1.4 archive for the headers to be used. The library is installed with Slackware's aaa_libraries. - Relevant files will be symlinked to the system libpng unversioned headers and libs if they are not linked to libpng14. Those symlinks will be reverted to libpng16 when the build has finished or failed. - This option will set libpng14 as the needed libpng for all koffice binaries in this build. - -[3] GraphicsMagick will enable an extended range of image formats to be loaded and saved. ImageMagick should be an alternative, but building fails with that, so without GM, the range of supported image formats will be limited. +[2] GraphicsMagick will enable an extended range of image formats to be loaded and saved. ImageMagick should be an alternative, but building fails with that, so without GM, the range of supported image formats will be limited. Choosing \Zb\Z3useGM\Zn here will add it to the build list if not already selected or installed. " \ -34 75 3 \ +21 75 2 \ " krita" "Set the app name to krita" on "\Zb\Z6 otherwise will be \Zb\Z3chalk\Zn" \ -" libpng14" "Build with libpng-1.4" on "\Zb\Z6 otherwise will be \Zb\Z3libpng-1.6\Zn" \ " useGM" "Use GraphicsMagick" on "\Zb\Z6 \Zn" \ 2> $TMPVARS/Krita_OPTS @@ -653,9 +646,6 @@ GM_VERSION=$(grep VERSION= $BUILD_TDE_ROOT/Misc/GraphicsMagick/GraphicsMagick.Sl [[ $(cat $TMPVARS/TDEbuilds) != *GraphicsMagick* ]] && \ [[ ! $(ls /var/log/packages/GraphicsMagick-$GM_VERSION*) ]] && \ sed -i 's|Apps/koffice|Misc/GraphicsMagick &|' $TMPVARS/TDEbuilds -## If libpng-1.4 has been selected, add it to the build list before koffice -[[ $(cat $TMPVARS/Krita_OPTS) == *libpng14* ]] && \ -sed -i 's|Apps/koffice|Misc/libpng &|' $TMPVARS/TDEbuilds rm -f $TMPVARS/Koffice_OPTS [[ $(cat $TMPVARS/Krita_OPTS) == *krita* ]] && CHALK=krita @@ -875,9 +865,10 @@ Confirm or change these build options .. [2] \Z3\Zbno_warn\Zn - don't display any compiler warning messages -[3] \Z3\Zbninja\Zn - use ninja for cmake builds +[3] \Z3\Zbninja\Zn - use ninja for cmake builds [ignored for automake builds] -[4] \Z3\Zbverbose\Zn - show -> command lines during cmake builds; 'make' debugging information; and standard error output. Using this is only recommended if fault finding. +[4] \Z3\Zbverbose\Zn - show -> command lines during cmake builds; 'make' debugging information; and standard error output. +Using this is only recommended if fault finding. " \ 25 75 4 \ @@ -946,13 +937,11 @@ export PLUGIN_INSTALL_DIR=$(cat $TMPVARS/SYS_CNF_DIR | cut -d/ -f3) ## koffice - only if it is being built [[ $(grep -o "Apps/koffice " $TMPVARS/TDEbuilds) ]] && { [[ $(cat $TMPVARS/Krita_OPTS) == *krita* ]] && RVT=yes || RVT=no -[[ $(cat $TMPVARS/Krita_OPTS) == *libpng14* ]] && USE_PNG=yes || USE_PNG=no [[ $(cat $TMPVARS/Krita_OPTS) == *useGM* ]] && USE_GM=yes || USE_GM=no } && \ KOFFICE=" koffice: revert chalk to krita \Zb\Z6$RVT\Zn - build with libpng14 \Zb\Z6$USE_PNG\Zn build with GraphicsMagick \Zb\Z6$USE_GM\Zn" # ## tqt3 options, if tqt3 is being built @@ -1076,9 +1065,6 @@ do LOG="" && [[ $PRE_DOWNLOAD == yes ]] && LOG="source_download" script -c "sh $package.SlackBuild" $TMP/$TDE_PFX$package-$(eval echo $version)-${LOG:-"${ARCH_i18n:-$ARCH}-$build-build"}-log || ${EXIT_FAIL:-"true"} -## if koffice was building with libpng14, and libpng was previously set to libpng16, restore the libpng16 installation -[[ -e $TMPVARS/Restore-libpng16 ]] && source $BUILD_TDE_ROOT/get-source.sh && libpng16_fn && rm $TMPVARS/Restore-libpng16 || true - # remove colorizing escape sequences from build-log # Re: http://serverfault.com/questions/71285/in-centos-4-4-how-can-i-strip-escape-sequences-from-a-text-file sed -ri "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g" $TMP/$TDE_PFX$package-$(eval echo $version)-${LOG:-"${ARCH_i18n:-$ARCH}-$build-build"}-log || ${EXIT_FAIL:-"true"} @@ -1101,8 +1087,7 @@ echo " ${EXIT_FAIL:-":"} } ## install packages - any 'Cannot install /tmp/....txz: file not found' error message caused by build failure deliberately not suppressed. -## libpng-1.4 package is a dummy. The libpng SB has been retained in case any future Slackware version no longer provides the libpng14 library. -[[ $INST == 1 ]] && [[ $package != tde-i18n* ]] && [[ $package != libpng ]] && upgradepkg --install-new --reinstall $TMP/$TDE_PFX$package-$(eval echo $version)-*-$build*.txz +[[ $INST == 1 ]] && [[ $package != tde-i18n* ]] && upgradepkg --install-new --reinstall $TMP/$TDE_PFX$package-$(eval echo $version)-*-$build*.txz } # back to original directory diff --git a/Misc/libpng/libpng.SlackBuild b/Misc/libpng/libpng.SlackBuild deleted file mode 100755 index c293e95..0000000 --- a/Misc/libpng/libpng.SlackBuild +++ /dev/null @@ -1,90 +0,0 @@ -#!/bin/sh -# Copyright 2015-2017 tde-slackbuilds project on GitHub -# All rights reserved. -# -# Permission to use, copy, modify, and distribute this software for -# any purpose with or without fee is hereby granted, provided that -# the above copyright notice and this permission notice appear in all -# copies. -# -# THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 AUTHORS AND COPYRIGHT HOLDERS AND THEIR -# CONTRIBUTORS 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. - -PRGNAM=libpng -VERSION=1.4.22 -BUILD=${BUILD:-1} -TAG=${TAG:-} - -ARCHIVE_TYPE="tar.xz" -SRCURL="https://downloads.sourceforge.net/project/libpng/libpng14/$VERSION/libpng-$VERSION.$ARCHIVE_TYPE" - -source ../../get-source.sh -getsource_fn - -untar_fn - -## exit the build here as only the headers are required for the koffice [chalk/krita] build -## but retain this script in case libpng14 is dropped from aaa_libraries in future -## and libpng14.so.14.22.0 needs to be built. -## Set a dummy package to remain compatible with the build system -touch $LIBPNG_TMP/libpng-1.4.22-x86_64-${BUILD:-1}.txz -exit - -listdocs_fn - -chown_fn - -cd_builddir_fn - -CFLAGS="$SLKCFLAGS" \ -CC=$COMPILER \ -../configure \ - --prefix=/usr \ - --libdir=/usr/lib$LIBDIRSUFFIX \ - --includedir=/usr/include \ - --mandir=/usr/man \ - --disable-static - -make_fn - -installdocs_fn - -INSTALL_TDE=/usr -mangzip_fn - -strip_fn - -mkdir_install_fn - -echo " -# HOW TO EDIT THIS FILE: -# The 'handy ruler' below makes it easier to edit a package description. Line -# up the first '|' above the ':' following the base package name, and the '|' -# on the right side marks the last column you can put a character in. You must -# make exactly 11 lines for the formatting to be correct. It's also -# customary to leave one space after the ':'. - |-----handy-ruler------------------------------------------------------| -$PRGNAM: libpng (Portable Network Graphics library) -$PRGNAM: -$PRGNAM: PNG (Portable Network Graphics) is an extensible file format for the -$PRGNAM: lossless, portable, well-compressed storage of raster images. PNG -$PRGNAM: provides a patent-free replacement for GIF and can also replace many -$PRGNAM: common uses of TIFF. Indexed-color, grayscale, and truecolor images -$PRGNAM: are supported, plus an optional alpha channel. Sample depths range -$PRGNAM: from 1 to 16 bits. -$PRGNAM: -$PRGNAM: -$PRGNAM: -" > $PKG/install/slack-desc - -makepkg_fn diff --git a/get-source.sh b/get-source.sh index 9f458c6..db2066d 100755 --- a/get-source.sh +++ b/get-source.sh @@ -410,17 +410,3 @@ echo " " >> $PKG/install/doinst.sh } -libpng16_fn () -{ -## restore libpng16 links -(cd /usr/include -ln -sf libpng16/pngconf.h pngconf.h -ln -sf libpng16/png.h png.h ) -(cd /usr/lib$LIBDIRSUFFIX -ln -sf libpng16.so libpng.so ) -## if libpng14.so has been created for this build, remove it -[[ -e $TMPVARS/LPNG14so ]] && { -rm /usr/lib$LIBDIRSUFFIX/libpng14.so -rm $TMPVARS/LPNG14so -} -}