From 5eaf7f40ff4f9dfd2fb006c9b08d929e04c82703 Mon Sep 17 00:00:00 2001 From: Bernard Cafarelli Date: Wed, 6 May 2020 00:45:05 +0200 Subject: media-gfx/argyllcms: fix build with -fno-common Patch from openSUSE Also set BDEPEND for ftjam/unzip Closes: https://bugs.gentoo.org/706842 Package-Manager: Portage-2.3.99, Repoman-2.3.22 Signed-off-by: Bernard Cafarelli --- media-gfx/argyllcms/argyllcms-2.1.2-r1.ebuild | 93 ++++++++++++++ .../files/argyllcms-2.1.2-fno-common.patch | 134 +++++++++++++++++++++ 2 files changed, 227 insertions(+) create mode 100644 media-gfx/argyllcms/argyllcms-2.1.2-r1.ebuild create mode 100644 media-gfx/argyllcms/files/argyllcms-2.1.2-fno-common.patch diff --git a/media-gfx/argyllcms/argyllcms-2.1.2-r1.ebuild b/media-gfx/argyllcms/argyllcms-2.1.2-r1.ebuild new file mode 100644 index 000000000000..25461f6d1758 --- /dev/null +++ b/media-gfx/argyllcms/argyllcms-2.1.2-r1.ebuild @@ -0,0 +1,93 @@ +# Copyright 1999-2020 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +inherit flag-o-matic multiprocessing toolchain-funcs udev + +MY_P="Argyll_V${PV}" + +DESCRIPTION="Open source, ICC compatible color management system" +HOMEPAGE="http://www.argyllcms.com/" +SRC_URI="http://www.argyllcms.com/${MY_P}_src.zip" + +LICENSE="AGPL-3" +SLOT="0" +KEYWORDS="~amd64 ~arm64 ~hppa ~x86" +IUSE="doc libressl" + +RDEPEND=" + media-libs/tiff:0 + sys-libs/zlib + virtual/jpeg:0 + x11-libs/libX11 + x11-libs/libXau + x11-libs/libXdmcp + x11-libs/libXext + x11-libs/libXinerama + x11-libs/libXrandr + x11-libs/libXxf86vm + x11-libs/libXScrnSaver + !libressl? ( dev-libs/openssl:0= ) + libressl? ( dev-libs/libressl:0= )" +DEPEND="${RDEPEND}" +BDEPEND="app-arch/unzip + dev-util/ftjam" + +PATCHES=( "${FILESDIR}"/${P}-fno-common.patch ) + +S="${WORKDIR}/${MY_P}" + +src_compile() { + # Make it respect LDFLAGS + echo "LINKFLAGS += ${LDFLAGS} ;" >> Jamtop + + # Evil hack to get --as-needed working. The build system unfortunately lists all + # the shared libraries by default on the command line _before_ the object to be built... + echo "STDLIBS += -ldl -lrt -lX11 -lXext -lXxf86vm -lXinerama -lXrandr -lXau -lXdmcp -lXss -ltiff -ljpeg ;" >> Jamtop + + append-cflags -DUNIX -D_THREAD_SAFE + + sed \ + -e 's:CCFLAGS:CFLAGS:g' \ + -e "s:ar rusc:$(tc-getAR) rusc:g" \ + -i Jambase || die + + tc-export CC RANLIB + + jam -dx -fJambase "-j$(makeopts_jobs)" || die +} + +src_install() { + jam -dx -fJambase install || die + + rm bin/License.txt || die + + pushd bin > /dev/null + local binname + for binname in * ; do + newbin ${binname} argyll-${binname} + done + popd > /dev/null + + dodoc log.txt Readme.txt ttbd.txt notes.txt + if use doc; then + docinto html + dodoc doc/*html doc/*jpg doc/*gif + fi + + insinto /usr/share/${PN} + doins -r ref + + udev_dorules usb/55-Argyll.rules +} + +pkg_postinst() { + elog "If you have a Spyder2 you need to extract the firmware" + elog "from the CVSpyder.dll of the windows driver package" + elog "and store it as /usr/share/color/spyd2PLD.bin" + echo + elog "For further info on setting up instrument access read" + elog "http://www.argyllcms.com/doc/Installing_Linux.html" + echo +} diff --git a/media-gfx/argyllcms/files/argyllcms-2.1.2-fno-common.patch b/media-gfx/argyllcms/files/argyllcms-2.1.2-fno-common.patch new file mode 100644 index 000000000000..36bf87d12550 --- /dev/null +++ b/media-gfx/argyllcms/files/argyllcms-2.1.2-fno-common.patch @@ -0,0 +1,134 @@ +argyllcms: Fix compilation with GCC 10 + +A common mistake in C is omitting extern when declaring a global variable +in a header file. If the header is included by several files it results +in multiple definitions of the same variable. In previous GCC versions +this error is ignored. GCC 10 defaults to -fno-common, which means a +linker error will now be reported. To fix this, use extern in header +files when declaring global variables, and ensure each global is defined +in exactly one C file. As a workaround, legacy C code can be compiled +with -fcommon. + + int x; // tentative definition - avoid in header files + extern int y; // correct declaration in a header file + +References: +https://bugzilla.opensuse.org/show_bug.cgi?id=1160244 +https://bugzilla.opensuse.org/show_bug.cgi?id=1160256 + +In case of vinflate.c and inflate.c, both files define local variables +with the same name as global. It is no more possible with GCC 10. To +prevent sharing variables across files, add "static" to all local +variables. + +Index: Argyll_V2.1.2/gamut/gamut.h +=================================================================== +--- Argyll_V2.1.2.orig/gamut/gamut.h ++++ Argyll_V2.1.2/gamut/gamut.h +@@ -36,7 +36,7 @@ + #define MAXGAMN 10 /* Maximum gamut point neighbors returned */ + #define NSLOTS 6 /* Number of maximum direction slots */ + +-struct _vrml *wrl; /* Declared in vrml.h, which may be #included after this */ ++struct _vrml; /* Declared in vrml.h, which may be #included after this */ + + /* ------------------------------------ */ + #define NODE_STRUCT \ +Index: Argyll_V2.1.2/spectro/vinflate.c +=================================================================== +--- Argyll_V2.1.2.orig/spectro/vinflate.c ++++ Argyll_V2.1.2/spectro/vinflate.c +@@ -92,7 +92,7 @@ int vinflate(void); + */ + + #define WSIZE 0x8000 +-unsigned int wp; /* current position in slide */ ++static unsigned int wp; /* current position in slide */ + uch slide[32768]; + + static int vflush_output(unsigned int w) { +@@ -160,8 +160,8 @@ static ush cpdext[] = { /* Extra + the stream. + */ + +-ulg bb; /* bit buffer */ +-unsigned bk; /* bits in bit buffer */ ++static ulg bb; /* bit buffer */ ++static unsigned bk; /* bits in bit buffer */ + + ush vmask_bits[] = { + 0x0000, +@@ -230,8 +230,8 @@ ush vmask_bits[] = { + */ + + +-int vlbits = 9; /* bits in base literal/length lookup table */ +-int vdbits = 6; /* bits in base distance lookup table */ ++static int vlbits = 9; /* bits in base literal/length lookup table */ ++static int vdbits = 6; /* bits in base distance lookup table */ + + + /* If BMAX needs to be larger than 16, then h and x[] should be ulg. */ +@@ -239,7 +239,7 @@ int vdbits = 6; /* bits in base + #define N_MAX 288 /* maximum number of codes in any set */ + + +-unsigned hufts; /* track memory usage */ ++static unsigned hufts; /* track memory usage */ + + /* Given a list of code lengths and a maximum table size, make a set of + tables to decode that set of codes. Return zero on success, one if +Index: Argyll_V2.1.2/spectro/inflate.c +=================================================================== +--- Argyll_V2.1.2.orig/spectro/inflate.c ++++ Argyll_V2.1.2/spectro/inflate.c +@@ -49,7 +49,7 @@ typedef unsigned int ulg; + the next table, which codes e - 16 bits, and lastly e == 99 indicates + an unused code. If a code with e == 99 is looked up, this implies an + error in the data. */ +-struct huft { ++static struct huft { + uch e; /* number of extra bits or operation */ + uch b; /* number of bits in this code or subcode */ + union { +@@ -87,7 +87,7 @@ int inflate(void); + /* unsigned wp; current position in slide */ + + #define WSIZE 0x8000 +-unsigned int wp; /* current position in slide */ ++static unsigned int wp; /* current position in slide */ + uch slide[32768]; + + static int flush_output(unsigned int w) { +@@ -155,8 +155,8 @@ static ush cpdext[] = { /* Extra + the stream. + */ + +-ulg bb; /* bit buffer */ +-unsigned bk; /* bits in bit buffer */ ++static ulg bb; /* bit buffer */ ++static unsigned bk; /* bits in bit buffer */ + + ush mask_bits[] = { + 0x0000, +@@ -201,8 +201,8 @@ ush mask_bits[] = { + */ + + +-int lbits = 9; /* bits in base literal/length lookup table */ +-int dbits = 6; /* bits in base distance lookup table */ ++static int lbits = 9; /* bits in base literal/length lookup table */ ++static int dbits = 6; /* bits in base distance lookup table */ + + + /* If BMAX needs to be larger than 16, then h and x[] should be ulg. */ +@@ -210,7 +210,7 @@ int dbits = 6; /* bits in base + #define N_MAX 288 /* maximum number of codes in any set */ + + +-unsigned hufts; /* track memory usage */ ++static unsigned hufts; /* track memory usage */ + + + static int huft_build(b, n, s, d, e, t, m) + -- cgit v1.2.3-18-g5258