git.iko.soy/typeable/nixpkgs
on master help sign in
mesa: Use symlinks instead of hard links for the DRI/vdpau drivers

This reduces the size of the drivers output from 193 MiB to 44 MiB. @vcunat

commit1a52fdc3c6a81b0b652ea21e59e7dd705fef5f2e authorEelco Dolstra <eelco.dolstra@logicblox.com> dateSun 22 May 2016, 18:05 (11 years ago) parent3ee6b22
2 files changed+73
pkgs/development/libraries/mesa/default.nix+1 pkgs/development/libraries/mesa/symlink-drivers.patch+72
pkgs/development/libraries/mesa/default.nix+1
@@ -45,6 +45,7 @@ stdenv.mkDerivation {
4545
4646 patches = [
4747 ./glx_ro_text_segm.patch # fix for grsecurity/PaX
48+ ./symlink-drivers.patch
4849 # TODO: revive ./dricore-gallium.patch when it gets ported (from Ubuntu),
4950 # as it saved ~35 MB in $drivers; watch https://launchpad.net/ubuntu/+source/mesa/+changelog
5051 ] ++ optional stdenv.isLinux
pkgs/development/libraries/mesa/symlink-drivers.patchnew file+72
@@ -0,0 +1,72 @@
1+diff -ru -x '*~' mesa-11.1.4-orig/src/gallium/targets/dri/Makefile.am mesa-11.1.4/src/gallium/targets/dri/Makefile.am
2+--- mesa-11.1.4-orig/src/gallium/targets/dri/Makefile.am 2016-05-09 14:20:52.000000000 +0200
3++++ mesa-11.1.4/src/gallium/targets/dri/Makefile.am 2016-05-22 17:56:03.396185082 +0200
4+@@ -126,14 +126,13 @@
5+ done;
6+ endif
7+
8+-# hardlink each megadriver instance, but don't actually have
9+-# gallium_dri.so in the set of final installed files.
10++# symlink each megadriver instance.
11+ install-data-hook:
12+ for i in $(TARGET_DRIVERS); do \
13+- ln -f $(DESTDIR)$(dridir)/gallium_dri.so \
14++ ln -sf $(DESTDIR)$(dridir)/gallium_dri.so \
15+ $(DESTDIR)$(dridir)/$${i}_dri.so; \
16+ done; \
17+- $(RM) $(DESTDIR)$(dridir)/gallium_dri.*
18++ $(RM) $(DESTDIR)$(dridir)/gallium_dri.la
19+
20+ uninstall-hook:
21+ for i in $(TARGET_DRIVERS); do \
22+diff -ru -x '*~' mesa-11.1.4-orig/src/gallium/targets/vdpau/Makefile.am mesa-11.1.4/src/gallium/targets/vdpau/Makefile.am
23+--- mesa-11.1.4-orig/src/gallium/targets/vdpau/Makefile.am 2016-01-29 13:21:30.000000000 +0100
24++++ mesa-11.1.4/src/gallium/targets/vdpau/Makefile.am 2016-05-22 20:54:12.722358242 +0200
25+@@ -103,15 +103,14 @@
26+ done;
27+ endif
28+
29+-# hardlink each megadriver instance, but don't actually have
30+-# libvdpau_gallium.so in the set of final installed files.
31++# symlink each megadriver instance.
32+ install-data-hook:
33+ $(AM_V_GEN)dest_dir=$(DESTDIR)/$(vdpaudir); \
34+ for i in $(TARGET_DRIVERS); do \
35+ j=libvdpau_gallium.$(LIB_EXT); \
36+ k=libvdpau_$${i}.$(LIB_EXT); \
37+ l=$${k}.$(VDPAU_MAJOR).$(VDPAU_MINOR).0; \
38+- ln -f $${dest_dir}/$${j}.$(VDPAU_MAJOR).$(VDPAU_MINOR).0 \
39++ ln -sf $${dest_dir}/$${j}.$(VDPAU_MAJOR).$(VDPAU_MINOR).0 \
40+ $${dest_dir}/$${l}; \
41+ ln -sf $${l} \
42+ $${dest_dir}/$${k}.$(VDPAU_MAJOR).$(VDPAU_MINOR); \
43+@@ -120,7 +119,7 @@
44+ ln -sf $${l} \
45+ $${dest_dir}/$${k}; \
46+ done; \
47+- $(RM) $${dest_dir}/libvdpau_gallium.*
48++ $(RM) $${dest_dir}/libvdpau_gallium.la
49+
50+ uninstall-hook:
51+ for i in $(TARGET_DRIVERS); do \
52+diff -ru -x '*~' mesa-11.1.4-orig/src/mesa/drivers/dri/Makefile.am mesa-11.1.4/src/mesa/drivers/dri/Makefile.am
53+--- mesa-11.1.4-orig/src/mesa/drivers/dri/Makefile.am 2016-01-18 08:39:26.000000000 +0100
54++++ mesa-11.1.4/src/mesa/drivers/dri/Makefile.am 2016-05-22 17:55:46.251244940 +0200
55+@@ -86,14 +86,13 @@
56+ done;
57+ endif
58+
59+-# hardlink each megadriver instance, but don't actually have
60+-# mesa_dri_drivers.so in the set of final installed files.
61++# symink each megadriver instance.
62+ install-data-hook:
63+ for i in $(MEGADRIVERS); do \
64+- ln -f $(DESTDIR)$(dridir)/mesa_dri_drivers.so \
65++ ln -sf $(DESTDIR)$(dridir)/mesa_dri_drivers.so \
66+ $(DESTDIR)$(dridir)/$$i; \
67+ done;
68+- $(RM) $(DESTDIR)$(dridir)/mesa_dri_drivers.*
69++ $(RM) $(DESTDIR)$(dridir)/mesa_dri_drivers.la
70+
71+ uninstall-hook:
72+ for i in $(MEGADRIVERS); do \