guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

03/04: gnu: python: Do not install static libraries.


From: guix-commits
Subject: 03/04: gnu: python: Do not install static libraries.
Date: Thu, 10 Jun 2021 21:00:02 -0400 (EDT)

roptat pushed a commit to branch core-updates
in repository guix.

commit 8ce96d84470912cadb6ecb03002236c52234dd9b
Author: Julien Lepiller <julien@lepiller.eu>
AuthorDate: Thu Jun 3 22:10:09 2021 +0200

    gnu: python: Do not install static libraries.
    
    This is something Fedora already does since 2010, so it should be safe,
    and saves a lot of space.
    
    * gnu/packages/patches/python-2.7-no-static-lib.patch: New file.
    * gnu/packages/patches/python-3-no-static-lib.patch: New file.
    * gnu/local.mk (dist_patch_DATA): Add them.
    * gnu/packages/python.scm (python-2.7, python-3): Use them.
---
 gnu/local.mk                                       |  2 +
 .../patches/python-2.7-no-static-lib.patch         | 70 ++++++++++++++++++++
 gnu/packages/patches/python-3-no-static-lib.patch  | 75 ++++++++++++++++++++++
 gnu/packages/python.scm                            |  6 +-
 4 files changed, 151 insertions(+), 2 deletions(-)

diff --git a/gnu/local.mk b/gnu/local.mk
index 890227c..09b8f57 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1550,11 +1550,13 @@ dist_patch_DATA =                                       
        \
   %D%/packages/patches/python-2.7-site-prefixes.patch          \
   %D%/packages/patches/python-2.7-source-date-epoch.patch      \
   %D%/packages/patches/python-2.7-CVE-2021-3177.patch          \
+  %D%/packages/patches/python-2.7-no-static-lib.patch          \
   %D%/packages/patches/python-3-arm-alignment.patch            \
   %D%/packages/patches/python-3-deterministic-build-info.patch \
   %D%/packages/patches/python-3-search-paths.patch             \
   %D%/packages/patches/python-3-fix-tests.patch                        \
   %D%/packages/patches/python-3-hurd-configure.patch           \
+  %D%/packages/patches/python-3-no-static-lib.patch            \
   %D%/packages/patches/python-CVE-2018-14647.patch             \
   %D%/packages/patches/python-CVE-2020-26116.patch             \
   %D%/packages/patches/python-aionotify-0.2.0-py3.8.patch      \
diff --git a/gnu/packages/patches/python-2.7-no-static-lib.patch 
b/gnu/packages/patches/python-2.7-no-static-lib.patch
new file mode 100644
index 0000000..0252998
--- /dev/null
+++ b/gnu/packages/patches/python-2.7-no-static-lib.patch
@@ -0,0 +1,70 @@
+From 92e2dcace7a3c02289b314238c5f18caec659ff1 Mon Sep 17 00:00:00 2001
+From: Julien Lepiller <julien@lepiller.eu>
+Date: Sat, 5 Jun 2021 12:41:47 +0200
+Subject: [PATCH] No static lib.
+
+This patch is adapted from Fedora. The original patch did not apply
+because of whitespace changes.
+
+00111 #
+Patch the Makefile.pre.in so that the generated Makefile doesn't try to build
+a libpythonMAJOR.MINOR.a (bug 550692):
+Downstream only: not appropriate for upstream
+---
+ Makefile.pre.in | 26 +-------------------------
+ 1 file changed, 1 insertion(+), 25 deletions(-)
+
+diff --git a/Makefile.pre.in b/Makefile.pre.in
+index 6239fc3..948f196 100644
+--- a/Makefile.pre.in
++++ b/Makefile.pre.in
+@@ -486,7 +486,7 @@ coverage-report: regen-grammar
+ 
+ 
+ # Build the interpreter
+-$(BUILDPYTHON):       Modules/python.o $(LIBRARY) $(LDLIBRARY)
++$(BUILDPYTHON):       Modules/python.o $(LDLIBRARY)
+               $(LINKCC) $(LDFLAGS) $(LINKFORSHARED) -o $@ \
+                       Modules/python.o \
+                       $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST)
+@@ -527,18 +527,6 @@ sharedmods: $(BUILDPYTHON) pybuilddir.txt Modules/_math.o
+               _TCLTK_INCLUDES='$(TCLTK_INCLUDES)' _TCLTK_LIBS='$(TCLTK_LIBS)' 
\
+               $(PY_BUILD_ENVIRON) $(PYTHON_FOR_BUILD) $(srcdir)/setup.py 
$$quiet build
+ 
+-# Build static library
+-# avoid long command lines, same as LIBRARY_OBJS
+-$(LIBRARY): $(LIBRARY_OBJS)
+-      -rm -f $@
+-      $(AR) $(ARFLAGS) $@ Modules/getbuildinfo.o
+-      $(AR) $(ARFLAGS) $@ $(PARSER_OBJS)
+-      $(AR) $(ARFLAGS) $@ $(OBJECT_OBJS)
+-      $(AR) $(ARFLAGS) $@ $(PYTHON_OBJS)
+-      $(AR) $(ARFLAGS) $@ $(MODULE_OBJS) $(SIGNAL_OBJS)
+-      $(AR) $(ARFLAGS) $@ $(MODOBJS)
+-      $(RANLIB) $@
+-
+ libpython$(VERSION).so: $(LIBRARY_OBJS)
+       if test $(INSTSONAME) != $(LDLIBRARY); then \
+               $(BLDSHARED) -Wl,-h$(INSTSONAME) -o $(INSTSONAME) 
$(LIBRARY_OBJS) $(MODLIBS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \
+@@ -1216,18 +1204,6 @@ libainstall:    @DEF_MAKE_RULE@ python-config
+               else    true; \
+               fi; \
+       done
+-      @if test -d $(LIBRARY); then :; else \
+-              if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \
+-                      if test "$(SO)" = .dll; then \
+-                              $(INSTALL_DATA) $(LDLIBRARY) $(DESTDIR)$(LIBPL) 
; \
+-                      else \
+-                              $(INSTALL_DATA) $(LIBRARY) 
$(DESTDIR)$(LIBPL)/$(LIBRARY) ; \
+-                              $(RANLIB) $(DESTDIR)$(LIBPL)/$(LIBRARY) ; \
+-                      fi; \
+-              else \
+-                      echo Skip install of $(LIBRARY) - use make 
frameworkinstall; \
+-              fi; \
+-      fi
+       $(INSTALL_DATA) Modules/config.c $(DESTDIR)$(LIBPL)/config.c
+       $(INSTALL_DATA) Modules/python.o $(DESTDIR)$(LIBPL)/python.o
+       $(INSTALL_DATA) $(srcdir)/Modules/config.c.in 
$(DESTDIR)$(LIBPL)/config.c.in
+-- 
+2.31.1
+
diff --git a/gnu/packages/patches/python-3-no-static-lib.patch 
b/gnu/packages/patches/python-3-no-static-lib.patch
new file mode 100644
index 0000000..b44dbc9
--- /dev/null
+++ b/gnu/packages/patches/python-3-no-static-lib.patch
@@ -0,0 +1,75 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: David Malcolm <dmalcolm@redhat.com>
+Date: Mon, 18 Jan 2010 17:59:07 +0000
+Subject: [PATCH] 00111: Don't try to build a libpythonMAJOR.MINOR.a
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Downstream only: not appropriate for upstream.
+
+See https://bugzilla.redhat.com/show_bug.cgi?id=556092
+
+Co-authored-by: David Malcolm <dmalcolm@redhat.com>
+Co-authored-by: Bohuslav Kabrda <bkabrda@redhat.com>
+Co-authored-by: Matej Stuchlik <mstuchli@redhat.com>
+Co-authored-by: Robert Kuska <rkuska@redhat.com>
+Co-authored-by: Charalampos Stratakis <cstratak@redhat.com>
+Co-authored-by: Miro HronĨok <miro@hroncok.cz>
+---
+ Makefile.pre.in | 21 ++-------------------
+ 1 file changed, 2 insertions(+), 19 deletions(-)
+
+diff --git a/Makefile.pre.in b/Makefile.pre.in
+index 0c3981c132..5587422ec7 100644
+--- a/Makefile.pre.in
++++ b/Makefile.pre.in
+@@ -589,7 +589,7 @@ clinic: check-clean-src 
$(srcdir)/Modules/_blake2/blake2s_impl.c
+       $(PYTHON_FOR_REGEN) $(srcdir)/Tools/clinic/clinic.py --make --srcdir 
$(srcdir)
+ 
+ # Build the interpreter
+-$(BUILDPYTHON):       Programs/python.o $(LIBRARY) $(LDLIBRARY) $(PY3LIBRARY) 
$(EXPORTSYMS)
++$(BUILDPYTHON):       Programs/python.o $(LDLIBRARY) $(PY3LIBRARY) 
$(EXPORTSYMS)
+       $(LINKCC) $(PY_CORE_LDFLAGS) $(LINKFORSHARED) -o $@ Programs/python.o 
$(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS)
+ 
+ platform: $(BUILDPYTHON) pybuilddir.txt
+@@ -637,12 +637,6 @@ sharedmods: $(BUILDPYTHON) pybuilddir.txt Modules/_math.o
+               _TCLTK_INCLUDES='$(TCLTK_INCLUDES)' _TCLTK_LIBS='$(TCLTK_LIBS)' 
\
+               $(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build
+ 
+-
+-# Build static library
+-$(LIBRARY): $(LIBRARY_OBJS)
+-      -rm -f $@
+-      $(AR) $(ARFLAGS) $@ $(LIBRARY_OBJS)
+-
+ libpython$(LDVERSION).so: $(LIBRARY_OBJS) $(DTRACE_OBJS)
+       if test $(INSTSONAME) != $(LDLIBRARY); then \
+               $(BLDSHARED) -Wl,-h$(INSTSONAME) -o $(INSTSONAME) 
$(LIBRARY_OBJS) $(MODLIBS) $(SHLIBS) $(LIBC) $(LIBM); \
+@@ -724,7 +718,7 @@ Makefile Modules/config.c: Makefile.pre \
+       @echo "The Makefile was updated, you may need to re-run make."
+ 
+ 
+-Programs/_testembed: Programs/_testembed.o $(LIBRARY) $(LDLIBRARY) 
$(PY3LIBRARY) $(EXPORTSYMS)
++Programs/_testembed: Programs/_testembed.o $(LDLIBRARY) $(PY3LIBRARY) 
$(EXPORTSYMS)
+       $(LINKCC) $(PY_CORE_LDFLAGS) $(LINKFORSHARED) -o $@ 
Programs/_testembed.o $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS)
+ 
+ ############################################################################
+@@ -1652,17 +1646,6 @@ libainstall:    @DEF_MAKE_RULE@ python-config
+               else    true; \
+               fi; \
+       done
+-      @if test -d $(LIBRARY); then :; else \
+-              if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \
+-                      if test "$(SHLIB_SUFFIX)" = .dll; then \
+-                              $(INSTALL_DATA) $(LDLIBRARY) $(DESTDIR)$(LIBPL) 
; \
+-                      else \
+-                              $(INSTALL_DATA) $(LIBRARY) 
$(DESTDIR)$(LIBPL)/$(LIBRARY) ; \
+-                      fi; \
+-              else \
+-                      echo Skip install of $(LIBRARY) - use make 
frameworkinstall; \
+-              fi; \
+-      fi
+       $(INSTALL_DATA) Modules/config.c $(DESTDIR)$(LIBPL)/config.c
+       $(INSTALL_DATA) Programs/python.o $(DESTDIR)$(LIBPL)/python.o
+       $(INSTALL_DATA) $(srcdir)/Modules/config.c.in 
$(DESTDIR)$(LIBPL)/config.c.in
diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm
index ca15147..e55794a 100644
--- a/gnu/packages/python.scm
+++ b/gnu/packages/python.scm
@@ -150,7 +150,8 @@
                                 "python-2.7-source-date-epoch.patch"
                                 "python-2.7-adjust-tests.patch"
                                 "python-cross-compile.patch"
-                                "python-2.7-CVE-2021-3177.patch"))
+                                "python-2.7-CVE-2021-3177.patch"
+                                "python-2.7-no-static-lib.patch"))
        (modules '((guix build utils)))
        (snippet
         '(begin
@@ -421,7 +422,8 @@ data types.")
                         "python-3-deterministic-build-info.patch"
                         "python-3-fix-tests.patch"
                         "python-3-hurd-configure.patch"
-                        "python-3-search-paths.patch"))
+                        "python-3-search-paths.patch"
+                        "python-3-no-static-lib.patch"))
               (sha256
                (base32
                 "10vdf46q5ldnzkprm8pldvr5a9hrdpxjv7mpzgdw6vj3cl318nhc"))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]