Import primus_0~20150328-17.debian.tar.xz
authorAndreas Beckmann <anbe@debian.org>
Thu, 14 Nov 2024 08:03:23 +0000 (09:03 +0100)
committerAndreas Beckmann <anbe@debian.org>
Thu, 14 Nov 2024 08:03:23 +0000 (09:03 +0100)
[dgit import tarball primus 0~20150328-17 primus_0~20150328-17.debian.tar.xz]

22 files changed:
changelog [new file with mode: 0644]
control [new file with mode: 0644]
copyright [new file with mode: 0644]
docs [new file with mode: 0644]
gbp.conf [new file with mode: 0644]
manpages [new file with mode: 0644]
patches/glvnd.patch [new file with mode: 0644]
patches/hardening.patch [new file with mode: 0644]
patches/no-PRIMUS_LOAD_GLOBAL.patch [new file with mode: 0644]
patches/primus-vk.patch [new file with mode: 0644]
patches/primusrun-multiarch.patch [new file with mode: 0644]
patches/series [new file with mode: 0644]
patches/workaround-bash-setenv.patch [new file with mode: 0644]
primus-libs.install [new file with mode: 0644]
primus.bash-completion [new file with mode: 0644]
primus.install [new file with mode: 0644]
primus.lintian-overrides [new file with mode: 0644]
rules [new file with mode: 0755]
salsa-ci.yml [new file with mode: 0644]
source/format [new file with mode: 0644]
upstream/metadata [new file with mode: 0644]
watch [new file with mode: 0644]

diff --git a/changelog b/changelog
new file mode 100644 (file)
index 0000000..a5c159d
--- /dev/null
+++ b/changelog
@@ -0,0 +1,252 @@
+primus (0~20150328-17) unstable; urgency=medium
+
+  * Update the list of supported drivers.
+  * Bump Standards-Version to 4.7.0, no changes needed.
+
+ -- Andreas Beckmann <anbe@debian.org>  Thu, 14 Nov 2024 09:03:23 +0100
+
+primus (0~20150328-16) unstable; urgency=medium
+
+  * Update the list of supported drivers.
+
+ -- Andreas Beckmann <anbe@debian.org>  Sat, 27 Jan 2024 00:14:00 +0100
+
+primus (0~20150328-15) unstable; urgency=medium
+
+  * Update the list of supported drivers.
+  * primus-nvidia: Do not build for armhf and i386.
+  * Switch to dh-sequence-bash-completion.
+  * Bump Standards-Version to 4.6.2, no changes needed.
+
+ -- Andreas Beckmann <anbe@debian.org>  Thu, 05 Jan 2023 02:52:44 +0100
+
+primus (0~20150328-14) unstable; urgency=medium
+
+  [ Andreas Beckmann ]
+  * Add salsa-ci.yml.
+  * Update the list of supported Tesla drivers.
+  * Bump Standards-Version to 4.6.0, no changes needed.
+
+  [ Debian Janitor ]
+  * Remove constraints unnecessary since buster:
+    + primus: Drop versioned constraint on xserver-xorg-core and
+      xserver-xorg-video-intel in Depends.
+    + Remove 1 maintscript entries from 1 files.
+
+ -- Andreas Beckmann <anbe@debian.org>  Sun, 03 Apr 2022 11:45:30 +0200
+
+primus (0~20150328-13) unstable; urgency=medium
+
+  [ Andreas Beckmann ]
+  * Bump watch version to 4. No changes needed.
+  * Bump Standards-Version to 4.5.1, no changes needed.
+
+  [ Vincent Cheng ]
+  * Remove myself from Uploaders.
+
+ -- Andreas Beckmann <anbe@debian.org>  Thu, 07 Jan 2021 17:21:56 +0100
+
+primus (0~20150328-12) unstable; urgency=medium
+
+  * primus-nvidia: Build for arm64.
+
+ -- Andreas Beckmann <anbe@debian.org>  Thu, 23 Jul 2020 23:15:02 +0200
+
+primus (0~20150328-11) unstable; urgency=medium
+
+  [ Andreas Beckmann ]
+  * Add B-D: libglapi-mesa for seamless backports.
+  * Switch to debhelper-compat (= 13).
+  * Update Lintian overrides.
+  * Recommend 'primus-libs:i386 (= ${binary:Version}) [amd64]' and get rid of
+    primus-libs-ia32.
+  * primus-libs: Recommend libprimus-vk1.
+  * primus-nvidia: Recommend nvidia-primus-vk-wrapper.
+  * primusrun: Export ENABLE_PRIMUS_LAYER=1 to let primus-vk (if available)
+    handle Vulkan applications.
+  * Build for more architectures.
+  * Use setenv() instead of putenv() to avoid use-after-unload issues.
+  * Work around setenv() issues in bash (see #962566).
+
+  [ Debian Janitor ]
+  * Set upstream metadata fields: Bug-Database, Bug-Submit, Repository-
+    Browse.
+  * Rely on pre-initialized dpkg-architecture variables.
+
+ -- Andreas Beckmann <anbe@debian.org>  Thu, 11 Jun 2020 21:11:23 +0200
+
+primus (0~20150328-10) unstable; urgency=medium
+
+  * Use upstream's primusrun and patch it for multiarch.  (Closes: #896140)
+  * Move primus-libs-ia32 recommendation to primus-libs.
+  * Set __GLVND_DISALLOW_PATCHING=1 before loading glvnd libraries.
+  * Support glvnd variant of the nvidia driver.  (Closes: #951914, #946978)
+  * Generate vendor-specific driver dependency lists for primus-nvidia.
+  * Enable all hardening flags.
+  * Remove PRIMUS_LOAD_GLOBAL HACK and link against libglapi.so.0 instead.
+  * Set upstream metadata field: Repository.
+  * Bump Standards-Version to 4.5.0, no changes needed.
+
+ -- Andreas Beckmann <anbe@debian.org>  Mon, 09 Mar 2020 11:19:01 +0100
+
+primus (0~20150328-9) unstable; urgency=medium
+
+  * Fix building twice in a row.
+  * Do not depend on transitional libgl1-mesa-glx package.
+  * Upload to unstable.
+
+ -- Andreas Beckmann <anbe@debian.org>  Sat, 24 Aug 2019 22:16:09 +0200
+
+primus (0~20150328-8) experimental; urgency=medium
+
+  * Add primus-nvidia metapackage.
+  * Switch to debhelper-compat (= 12).
+  * Bump Standards-Version to 4.4.0, no changes.
+  * Add myself to Uploaders.
+  * Upload to experimental.
+
+ -- Andreas Beckmann <anbe@debian.org>  Thu, 01 Aug 2019 09:09:47 +0200
+
+primus (0~20150328-7) unstable; urgency=medium
+
+  [ Andreas Beckmann ]
+  * Switch Vcs-* URLs to salsa.debian.org.
+  * Set Rules-Requires-Root: no.
+  * The dbgsym migration was done in stretch.
+  * Extend the Breaks and Suggests to the NVIDIA 390xx legacy driver.
+
+  [ Luca Boccassi ]
+  * Switch to debhelper compat level 11.
+  * Bump Standards-Version to 4.3.0, no changes.
+
+ -- Luca Boccassi <bluca@debian.org>  Sat, 05 Jan 2019 11:29:10 +0100
+
+primus (0~20150328-6) unstable; urgency=medium
+
+  * Bump Standards-Version to 4.1.3, no changes.
+  * Break: nvidia-driver-libs and suggest nvidia-driver-libs-nonglvnd.
+    (Closes: #888020)
+
+ -- Luca Boccassi <bluca@debian.org>  Mon, 22 Jan 2018 21:09:34 +0000
+
+primus (0~20150328-5) unstable; urgency=medium
+
+  * Switch to @debian.org email address.
+  * Switch priority from "extra" to "optional" to comply with policy 4.0.1.
+  * Use https for Vcs fields in d/control.
+  * Use https for the d/copyright format field to comply with policy 4.0.0.
+  * Bump Standards-Version to 4.1.1.
+  * Do not install primus with the GLVND-enabled Nvidia packages, as they
+    are not quite compatible yet. (Closes: #876033)
+
+ -- Luca Boccassi <bluca@debian.org>  Tue, 10 Oct 2017 20:46:09 +0100
+
+primus (0~20150328-4) unstable; urgency=medium
+
+  * Depend alternatively on xserver-xorg-video-intel or
+    xserver-xorg-core >= 2:1.18.3-2, as both enable SNA by default.
+
+ -- Luca Boccassi <luca.boccassi@gmail.com>  Fri, 22 Jul 2016 08:37:15 +0100
+
+primus (0~20150328-3) unstable; urgency=medium
+
+  * Move xserver-xorg-video-intel dependency from primus-libs to primus.
+    (Closes: #831640)
+
+ -- Luca Boccassi <luca.boccassi@gmail.com>  Mon, 18 Jul 2016 09:30:57 +0100
+
+primus (0~20150328-2) unstable; urgency=medium
+
+  * Add myself to Uploaders.
+  * Bump Standards-Version to 3.9.8, no changes.
+  * Remove -dbg package in favour of -dbgsym.
+  * Add dependency to xserver-xorg-video-intel >= 2.99.17 for SNA.
+
+ -- Luca Boccassi <luca.boccassi@gmail.com>  Sun, 17 Jul 2016 18:28:11 +0100
+
+primus (0~20150328-1) unstable; urgency=medium
+
+  * New upstream git snapshot.
+    - rebase on d1afbf6fce
+    - refresh hardening.patch
+  * Build with PRIMUS_UPLOAD=0 now that xserver-xorg-video-intel in sid has
+    SNA enabled by default.
+  * Add dependency on libgl1-mesa-glx to primus-libs. (LP: #1383909)
+  * Move bumblebee bash-completion file from obsolete /etc/bash_completion.d/
+    to /usr/share/bash-completion/completions/.
+
+ -- Vincent Cheng <vcheng@debian.org>  Sat, 25 Jul 2015 20:42:42 -0700
+
+primus (0~20140711-1) unstable; urgency=medium
+
+  [ Vincent Cheng ]
+  * New upstream git snapshot.
+    - rebase on 4e000124ec
+  * Update email address.
+  * Update Standards version to 3.9.6, no changes required.
+
+  [ Andreas Beckmann ]
+  * hardening.patch: New. Use all variables that contain hardening flags.
+
+ -- Vincent Cheng <vcheng@debian.org>  Wed, 15 Jan 2014 14:14:25 -0800
+
+primus (0~20131127-2) unstable; urgency=medium
+
+  * Build with PRIMUS_UPLOAD=1 to avoid a bug triggered by using primus and
+    xserver-xorg-video-intel with UXA acceleration enabled (which is currently
+    the default with xserver-xorg-video-intel 2:2.21.15-1 in unstable).
+    This workaround will remain in effect until xserver-xorg-video-intel
+    defaults to SNA in unstable. This flag will not be set if build
+    environment is Ubuntu, as SNA is already enabled by default (in trusty).
+
+ -- Vincent Cheng <Vincentc1208@gmail.com>  Tue, 07 Jan 2014 01:56:18 -0800
+
+primus (0~20131127-1) unstable; urgency=medium
+
+  * New upstream git snapshot.
+    - rebase on 074817614c
+  * Update Standards version to 3.9.5, no changes required.
+
+ -- Vincent Cheng <Vincentc1208@gmail.com>  Mon, 06 Jan 2014 01:36:38 -0800
+
+primus (0~20130904-1) unstable; urgency=low
+
+  * New upstream git snapshot.
+    - rebase on da6459236b
+
+ -- Vincent Cheng <Vincentc1208@gmail.com>  Wed, 23 Oct 2013 01:03:15 -0700
+
+primus (0~20130805-1) unstable; urgency=low
+
+  * New upstream git snapshot.
+    - rebase on 3f248d9f13
+
+ -- Vincent Cheng <Vincentc1208@gmail.com>  Tue, 20 Aug 2013 02:13:51 -0700
+
+primus (0~20130601-1) unstable; urgency=low
+
+  * New upstream git snapshot.
+    - rebase on 38731d5375
+    - fixes FTBFS on oldstable with gcc < 4.6 (Closes: #710025)
+
+ -- Vincent Cheng <Vincentc1208@gmail.com>  Thu, 06 Jun 2013 00:31:34 -0700
+
+primus (0~20130527-1) unstable; urgency=low
+
+  * New upstream git snapshot.
+    - rebase on 618acb99e0
+
+ -- Vincent Cheng <Vincentc1208@gmail.com>  Wed, 29 May 2013 01:49:06 -0700
+
+primus (0~20130511-1) unstable; urgency=low
+
+  * New upstream git snapshot.
+    - rebase on ef73dd1976
+
+ -- Vincent Cheng <Vincentc1208@gmail.com>  Thu, 16 May 2013 00:17:46 -0700
+
+primus (0~20130427-1) unstable; urgency=low
+
+  * Initial release. (Closes: #692597)
+
+ -- Vincent Cheng <Vincentc1208@gmail.com>  Fri, 03 May 2013 03:26:17 -0700
diff --git a/control b/control
new file mode 100644 (file)
index 0000000..26be72a
--- /dev/null
+++ b/control
@@ -0,0 +1,73 @@
+Source: primus
+Section: utils
+Priority: optional
+Maintainer: Debian NVIDIA Maintainers <pkg-nvidia-devel@lists.alioth.debian.org>
+Uploaders:
+ Aron Xu <aron@debian.org>,
+ Yunqiang Su <wzssyqa@gmail.com>,
+ Luca Boccassi <bluca@debian.org>,
+ Andreas Beckmann <anbe@debian.org>,
+Build-Depends:
+ debhelper-compat (= 13),
+ dh-sequence-bash-completion,
+ libglapi-mesa,
+ mesa-common-dev,
+Rules-Requires-Root: no
+Standards-Version: 4.7.0
+Homepage: https://github.com/amonakov/primus
+Vcs-Browser: https://salsa.debian.org/nvidia-team/primus
+Vcs-Git: https://salsa.debian.org/nvidia-team/primus.git
+
+Package: primus
+Architecture: linux-any
+Depends:
+ bumblebee (>= 3.2.1-21~),
+ primus-libs (= ${binary:Version}),
+ xserver-xorg-core | xserver-xorg-video-intel,
+ ${misc:Depends},
+Suggests:
+ primus-nvidia [amd64 arm64 ppc64el],
+Description: client-side GPU offloading for NVIDIA Optimus
+ Primus is a shared library that provides OpenGL and GLX APIs and implements
+ low-overhead local-only client-side OpenGL offloading via GLX forking,
+ similar to VirtualGL. It intercepts GLX calls and redirects GL rendering
+ to a secondary X display, presumably driven by a faster GPU. On swapping
+ buffers, rendered contents are read back using a PBO and copied onto
+ the drawable it was supposed to be rendered on in the first place.
+ .
+ Primus is currently intended to be used alongside Bumblebee and provides a
+ drop-in replacement for optirun (i.e. "primusrun").
+
+Package: primus-libs
+Architecture: linux-any
+Multi-Arch: same
+Depends: ${shlibs:Depends}, ${misc:Depends}, libgl1, libglx-mesa0
+Recommends:
+ primus-libs:i386 (= ${binary:Version}) [amd64],
+ libprimus-vk1,
+Conflicts:
+ primus-libs-ia32,
+Description: shared libraries for primus
+ Primus is a shared library that provides OpenGL and GLX APIs and implements
+ low-overhead local-only client-side OpenGL offloading via GLX forking,
+ similar to VirtualGL. It intercepts GLX calls and redirects GL rendering
+ to a secondary X display, presumably driven by a faster GPU. On swapping
+ buffers, rendered contents are read back using a PBO and copied onto
+ the drawable it was supposed to be rendered on in the first place.
+ .
+ This package contains the libraries for primus which are loaded when running
+ primusrun.
+
+Package: primus-nvidia
+Architecture: amd64 arm64 ppc64el
+Section: contrib/utils
+Depends:
+ ${nvidia:Depends},
+ primus (= ${binary:Version}),
+ ${misc:Depends},
+Recommends:
+ nvidia-primus-vk-wrapper,
+Description: NVIDIA Primus support using the proprietary NVIDIA driver
+ This metapackage ensures that the proprietary NVIDIA driver is installed in a
+ way such that 3D acceleration does not break. It does so by configuring the
+ OpenGL library path to use the Mesa graphics library.
diff --git a/copyright b/copyright
new file mode 100644 (file)
index 0000000..15ad57b
--- /dev/null
+++ b/copyright
@@ -0,0 +1,41 @@
+Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+Upstream-Name: primus
+Source: https://github.com/amonakov/primus
+
+Files: *
+Copyright: 2012-2013 Alexander Monakov <amonakov@gmail.com> 
+License: ISC
+ Permission to use, copy, modify, and/or 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.
+ .
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ PERFORMANCE OF THIS SOFTWARE.
+
+Files: debian/*
+Copyright: 2012 Dmitry Zhurikhin <zhurikhin@gmail.com>
+           2013 Bruno Pagani <bruno.n.pagani@gmail.com>
+           2013-2015 Vincent Cheng <vcheng@debian.org>
+           © 2014-2024 Andreas Beckmann <anbe@debian.org>
+           2016-2019 Luca Boccassi <bluca@debian.org>
+License: GPL-3.0+
+ This package is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+ .
+ This package is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ GNU General Public License for more details.
+ .
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>
+ .
+ On Debian systems, the complete text of the GNU General
+ Public License version 3 can be found in "/usr/share/common-licenses/GPL-3".
diff --git a/docs b/docs
new file mode 100644 (file)
index 0000000..7daf99b
--- /dev/null
+++ b/docs
@@ -0,0 +1,2 @@
+README.md
+technotes.md
diff --git a/gbp.conf b/gbp.conf
new file mode 100644 (file)
index 0000000..9048820
--- /dev/null
+++ b/gbp.conf
@@ -0,0 +1,2 @@
+[DEFAULT]
+debian-branch = main
diff --git a/manpages b/manpages
new file mode 100644 (file)
index 0000000..b7c3def
--- /dev/null
+++ b/manpages
@@ -0,0 +1 @@
+primusrun.1
diff --git a/patches/glvnd.patch b/patches/glvnd.patch
new file mode 100644 (file)
index 0000000..c922ecc
--- /dev/null
@@ -0,0 +1,15 @@
+Description: set __GLVND_DISALLOW_PATCHING=1 before loading glvnd libraries
+Author: Andreas Beckmann <anbe@debian.org>
+
+--- a/libglfork.cpp
++++ b/libglfork.cpp
+@@ -165,6 +165,9 @@ struct ContextsInfo: public std::map<GLX
+ struct EarlyInitializer {
+   EarlyInitializer(const char **adpy_strp, const char **libgla_strp)
+   {
++    // Allow multiple glvnd libGL.so.1 instances to be loaded into a process
++    // and OpenGL calls dispatched to them depending on context.
++    setenv("__GLVND_DISALLOW_PATCHING", "1", 0);
+ #ifdef BUMBLEBEE_SOCKET
+     // Signal the Bumblebee daemon to bring up secondary X
+     int sock = socket(PF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0);
diff --git a/patches/hardening.patch b/patches/hardening.patch
new file mode 100644 (file)
index 0000000..2c04972
--- /dev/null
@@ -0,0 +1,13 @@
+Description: use all variables containing hardening flags
+Forwarded: https://github.com/amonakov/primus/pull/174
+Author: Andreas Beckmann <anbe@debian.org>
+Last-Update: 2015-07-25
+
+--- a/Makefile
++++ b/Makefile
+@@ -30,4 +30,4 @@ CXXFLAGS += -DPRIMUS_libGLd='"$(PRIMUS_libGLd)"'
+ $(LIBDIR)/libGL.so.1: libglfork.cpp
+       mkdir -p $(LIBDIR)
+-      $(CXX) $(CPPFLAGS) $(CXXFLAGS) -fvisibility=hidden -fPIC -shared -Wl,-Bsymbolic -o $@ $< -lX11 -lpthread -lrt
++      $(CXX) $(CPPFLAGS) $(CXXFLAGS) -fvisibility=hidden -fPIC -shared -Wl,-Bsymbolic -o $@ $< $(LDFLAGS) -lX11 -lpthread -lrt
diff --git a/patches/no-PRIMUS_LOAD_GLOBAL.patch b/patches/no-PRIMUS_LOAD_GLOBAL.patch
new file mode 100644 (file)
index 0000000..00f300c
--- /dev/null
@@ -0,0 +1,64 @@
+Description: remove PRIMUS_LOAD_GLOBAL HACK
+ and link against libglapi.so.0 instead
+Author: Andreas Beckmann <anbe@debian.org>
+
+--- a/Makefile
++++ b/Makefile
+@@ -14,7 +14,6 @@ PRIMUS_VERBOSE     ?= 1
+ PRIMUS_UPLOAD      ?= 0
+ PRIMUS_SLEEP       ?= 90
+ PRIMUS_DISPLAY     ?= :8
+-PRIMUS_LOAD_GLOBAL ?= libglapi.so.0
+ PRIMUS_libGLa      ?= /usr/$$LIB/nvidia/libGL.so.1
+ PRIMUS_libGLd      ?= /usr/$$LIB/libGL.so.1
+@@ -24,10 +23,9 @@ CXXFLAGS += -DPRIMUS_VERBOSE='"$(PRIMUS_
+ CXXFLAGS += -DPRIMUS_UPLOAD='"$(PRIMUS_UPLOAD)"'
+ CXXFLAGS += -DPRIMUS_SLEEP='"$(PRIMUS_SLEEP)"'
+ CXXFLAGS += -DPRIMUS_DISPLAY='"$(PRIMUS_DISPLAY)"'
+-CXXFLAGS += -DPRIMUS_LOAD_GLOBAL='"$(PRIMUS_LOAD_GLOBAL)"'
+ CXXFLAGS += -DPRIMUS_libGLa='"$(PRIMUS_libGLa)"'
+ CXXFLAGS += -DPRIMUS_libGLd='"$(PRIMUS_libGLd)"'
+ $(LIBDIR)/libGL.so.1: libglfork.cpp
+       mkdir -p $(LIBDIR)
+-      $(CXX) $(CPPFLAGS) $(CXXFLAGS) -fvisibility=hidden -fPIC -shared -Wl,-Bsymbolic -o $@ $< $(LDFLAGS) -lX11 -lpthread -lrt
++      $(CXX) $(CPPFLAGS) $(CXXFLAGS) -fvisibility=hidden -fPIC -shared -Wl,-Bsymbolic -o $@ $< $(LDFLAGS) -lX11 -lpthread -lrt -Wl,--no-as-needed /usr/lib/$(DEB_HOST_MULTIARCH)/libglapi.so.0
+--- a/libglfork.cpp
++++ b/libglfork.cpp
+@@ -233,9 +233,6 @@ static struct PrimusInfo {
+   // The "displaying" X display. The same as the application is using, but
+   // primus opens its own connection.
+   Display *ddpy;
+-  // An artifact: primus needs to make symbols from libglapi.so globally
+-  // visible before loading Mesa
+-  const void *needed_global;
+   CapturedFns afns;
+   CapturedFns dfns;
+   // FIXME: there are race conditions in accesses to these
+@@ -252,13 +249,11 @@ static struct PrimusInfo {
+     autosleep(atoi(getconf(PRIMUS_SLEEP))),
+     adpy(XOpenDisplay(adpy_str)),
+     ddpy(XOpenDisplay(NULL)),
+-    needed_global(dlopen(getconf(PRIMUS_LOAD_GLOBAL), RTLD_LAZY | RTLD_GLOBAL)),
+     afns(libgla_str),
+     dfns(getconf(PRIMUS_libGLd))
+   {
+     die_if(!adpy, "failed to open secondary X display\n");
+     die_if(!ddpy, "failed to open main X display\n");
+-    die_if(!needed_global, "failed to load PRIMUS_LOAD_GLOBAL\n");
+   }
+ } primus;
+--- a/primusrun
++++ b/primusrun
+@@ -33,9 +33,6 @@ PRIMUS_libGL=${PRIMUS_libGL:-/usr/lib/x8
+ # in default search paths.  Add its path manually after the primus library
+ # PRIMUS_libGL=${PRIMUS_libGL}:/usr/lib/nvidia-current:/usr/lib32/nvidia-current
+-# Mesa drivers need a few symbols to be visible
+-# export PRIMUS_LOAD_GLOBAL=${PRIMUS_LOAD_GLOBAL:-'libglapi.so.0'}
+-
+ # Need functions from primus libGL to take precedence
+ export LD_LIBRARY_PATH=${PRIMUS_libGL}${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
diff --git a/patches/primus-vk.patch b/patches/primus-vk.patch
new file mode 100644 (file)
index 0000000..823d713
--- /dev/null
@@ -0,0 +1,14 @@
+Author: Andreas Beckmann <anbe@debian.org>
+Description: primusrun: set ENABLE_PRIMUS_LAYER=1 to enable primus-vk handling
+
+--- a/primusrun
++++ b/primusrun
+@@ -36,5 +36,8 @@ PRIMUS_libGL=${PRIMUS_libGL:-/usr/lib/x8
+ # Need functions from primus libGL to take precedence
+ export LD_LIBRARY_PATH=${PRIMUS_libGL}${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
++# Vulkan applications are handled via primus-vk
++export ENABLE_PRIMUS_LAYER=${ENABLE_PRIMUS_LAYER:-1}
++
+ # And go!
+ exec "$@"
diff --git a/patches/primusrun-multiarch.patch b/patches/primusrun-multiarch.patch
new file mode 100644 (file)
index 0000000..b1f5585
--- /dev/null
@@ -0,0 +1,16 @@
+Description: primusrun: search PRIMUS_libGL in multiarch locations
+Author: Andreas Beckmann <anbe@debian.org>
+Last-Update: 2020-03-04
+
+--- a/primusrun
++++ b/primusrun
+@@ -26,7 +26,8 @@
+ # export PRIMUS_libGLd=${PRIMUS_libGLd:-'/usr/$LIB/libGL.so.1'}
+ # Directory containing primus libGL
+-PRIMUS_libGL=${PRIMUS_libGL:-$(dirname `readlink -ne $0`)/'$LIB'}
++# PRIMUS_libGL=${PRIMUS_libGL:-$(dirname `readlink -ne $0`)/'$LIB'}
++PRIMUS_libGL=${PRIMUS_libGL:-/usr/lib/x86_64-linux-gnu/primus:/usr/lib/i386-linux-gnu/primus}
+ # On some distributions, e.g. on Ubuntu, libnvidia-tls.so is not available
+ # in default search paths.  Add its path manually after the primus library
diff --git a/patches/series b/patches/series
new file mode 100644 (file)
index 0000000..97a1024
--- /dev/null
@@ -0,0 +1,6 @@
+hardening.patch
+glvnd.patch
+primusrun-multiarch.patch
+no-PRIMUS_LOAD_GLOBAL.patch
+primus-vk.patch
+workaround-bash-setenv.patch
diff --git a/patches/workaround-bash-setenv.patch b/patches/workaround-bash-setenv.patch
new file mode 100644 (file)
index 0000000..b7ffd85
--- /dev/null
@@ -0,0 +1,23 @@
+Author: Andreas Beckmann <anbe@debian.org>
+Description: do not set environment variables in bash processes
+
+--- a/libglfork.cpp
++++ b/libglfork.cpp
+@@ -165,9 +165,17 @@ struct ContextsInfo: public std::map<GLX
+ struct EarlyInitializer {
+   EarlyInitializer(const char **adpy_strp, const char **libgla_strp)
+   {
++    // Setting environment variables in a bash process from an LD_PRELOAD
++    // library during initialization may be harmful. It can temporarily wipe
++    // the environment making subsequent getenv() return NULL (see #962566).
++    // Not setting this variable will allow primus to continue its
++    // initialization while possibly breaking OpenGL usage in bash processes
++    // (but not in subsequent processes started from bash scripts).
++    if (!dlsym(RTLD_DEFAULT, "bash_copyright")) {
+     // Allow multiple glvnd libGL.so.1 instances to be loaded into a process
+     // and OpenGL calls dispatched to them depending on context.
+     setenv("__GLVND_DISALLOW_PATCHING", "1", 0);
++    }
+ #ifdef BUMBLEBEE_SOCKET
+     // Signal the Bumblebee daemon to bring up secondary X
+     int sock = socket(PF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0);
diff --git a/primus-libs.install b/primus-libs.install
new file mode 100644 (file)
index 0000000..3a20976
--- /dev/null
@@ -0,0 +1 @@
+lib/*  usr/lib/${DEB_HOST_MULTIARCH}/primus/
diff --git a/primus.bash-completion b/primus.bash-completion
new file mode 100644 (file)
index 0000000..4bbaa34
--- /dev/null
@@ -0,0 +1 @@
+primus.bash-completion primus
diff --git a/primus.install b/primus.install
new file mode 100644 (file)
index 0000000..7545099
--- /dev/null
@@ -0,0 +1 @@
+primusrun      usr/bin/
diff --git a/primus.lintian-overrides b/primus.lintian-overrides
new file mode 100644 (file)
index 0000000..6f54990
--- /dev/null
@@ -0,0 +1,2 @@
+# We do not build arch:all packages for the proprietary driver.
+package-contains-no-arch-dependent-files
diff --git a/rules b/rules
new file mode 100755 (executable)
index 0000000..543883e
--- /dev/null
+++ b/rules
@@ -0,0 +1,45 @@
+#!/usr/bin/make -f
+# -*- makefile -*-
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+nv_libs_Debian += nvidia-driver-libs                           [!armhf] |
+nv_libs_Debian += nvidia-tesla-535-driver-libs                 [amd64 i386 arm64 ppc64el] |
+nv_libs_Debian += nvidia-driver-libs-any |
+nv_libs_Debian += bumblebee-nvidia |
+
+nv_libs_Ubuntu += bumblebee-nvidia |
+
+VENDOR         := $(shell dpkg-vendor --derives-from Ubuntu && echo Ubuntu || echo Debian)
+
+DPKG_EXPORT_BUILDFLAGS = 1
+export DEB_BUILD_MAINT_OPTIONS = hardening=+all
+include /usr/share/dpkg/default.mk
+
+include /usr/share/dpkg/architecture.mk
+
+ifeq ($(VENDOR),Ubuntu)
+       PRIMUS_libGLa=/usr/lib/$(DEB_HOST_MULTIARCH)/mesa/libGL.so.1
+       PRIMUS_libGLd=/usr/lib/$(DEB_HOST_MULTIARCH)/mesa/libGL.so.1
+else
+       PRIMUS_libGLa=/usr/lib/$(DEB_HOST_MULTIARCH)/libGL.so.1
+       PRIMUS_libGLd=/usr/lib/$(DEB_HOST_MULTIARCH)/libGL.so.1
+endif
+
+# Where to put the resulting library during build
+BUILD_LIBDIR ?= lib
+
+%:
+       dh $@
+
+execute_after_dh_auto_clean:
+       rm -rf $(BUILD_LIBDIR)
+
+override_dh_auto_build:
+       dh_auto_build -- LIBDIR=$(BUILD_LIBDIR) \
+           PRIMUS_libGLd=$(PRIMUS_libGLd) \
+           PRIMUS_libGLa=$(PRIMUS_libGLa)
+
+override_dh_gencontrol:
+       dh_gencontrol -- -V'nvidia:Depends=$(nv_libs_$(VENDOR))'
diff --git a/salsa-ci.yml b/salsa-ci.yml
new file mode 100644 (file)
index 0000000..9d6f295
--- /dev/null
@@ -0,0 +1,6 @@
+---
+include:
+  - https://salsa.debian.org/salsa-ci-team/pipeline/raw/master/recipes/debian.yml
+
+variables:
+  SALSA_CI_COMPONENTS: 'main contrib non-free'
diff --git a/source/format b/source/format
new file mode 100644 (file)
index 0000000..163aaf8
--- /dev/null
@@ -0,0 +1 @@
+3.0 (quilt)
diff --git a/upstream/metadata b/upstream/metadata
new file mode 100644 (file)
index 0000000..b91af59
--- /dev/null
@@ -0,0 +1,4 @@
+Bug-Database: https://github.com/amonakov/primus/issues
+Bug-Submit: https://github.com/amonakov/primus/issues/new
+Repository: https://github.com/amonakov/primus.git
+Repository-Browse: https://github.com/amonakov/primus
diff --git a/watch b/watch
new file mode 100644 (file)
index 0000000..c6a4a80
--- /dev/null
+++ b/watch
@@ -0,0 +1,2 @@
+version=4
+https://github.com/amonakov/primus/tags .*/v?(\d.*)\.(?:tgz|tbz2|tar\.(?:gz|bz2|xz))