unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Building a library as both static and dynamic
@ 2020-09-27 11:57 Greg Hogan
  2020-09-29  5:09 ` Efraim Flashner
  2020-10-05 13:39 ` Ludovic Courtès
  0 siblings, 2 replies; 3+ messages in thread
From: Greg Hogan @ 2020-09-27 11:57 UTC (permalink / raw)
  To: guix-devel

Is there a best practice or example for building a library twice, both static and dynamic? I submitted patch #43620, and in working on another library have the same issue. These are cmake builds with a parameter declaration for either a static or dynamic build, not both. I would like to create a single package with both “out” and “static” outputs, which looks to be standard across Guix.

One idea is to run the configure / make / make install phases twice. modify-phases does not currently support copying phases (though add-after could work with the right function reference from cmake-build) and #:configure-flags would need to be set differently.

Another option would be to patch the source build files, but this problem feels solvable in Guix without duplicating the code from cmake-build’s configure.

Thanks,
Greg

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Building a library as both static and dynamic
  2020-09-27 11:57 Building a library as both static and dynamic Greg Hogan
@ 2020-09-29  5:09 ` Efraim Flashner
  2020-10-05 13:39 ` Ludovic Courtès
  1 sibling, 0 replies; 3+ messages in thread
From: Efraim Flashner @ 2020-09-29  5:09 UTC (permalink / raw)
  To: Greg Hogan; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 1256 bytes --]

On Sun, Sep 27, 2020 at 07:57:19AM -0400, Greg Hogan wrote:
> Is there a best practice or example for building a library twice, both static and dynamic? I submitted patch #43620, and in working on another library have the same issue. These are cmake builds with a parameter declaration for either a static or dynamic build, not both. I would like to create a single package with both “out” and “static” outputs, which looks to be standard across Guix.
> 
> One idea is to run the configure / make / make install phases twice. modify-phases does not currently support copying phases (though add-after could work with the right function reference from cmake-build) and #:configure-flags would need to be set differently.
> 
> Another option would be to patch the source build files, but this problem feels solvable in Guix without duplicating the code from cmake-build’s configure.
> 
> Thanks,
> Greg

x265 is a package that uses cmake and is built multiple times with
different options and with a separate static output.

-- 
Efraim Flashner   <efraim@flashner.co.il>   אפרים פלשנר
GPG key = A28B F40C 3E55 1372 662D  14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Building a library as both static and dynamic
  2020-09-27 11:57 Building a library as both static and dynamic Greg Hogan
  2020-09-29  5:09 ` Efraim Flashner
@ 2020-10-05 13:39 ` Ludovic Courtès
  1 sibling, 0 replies; 3+ messages in thread
From: Ludovic Courtès @ 2020-10-05 13:39 UTC (permalink / raw)
  To: Greg Hogan; +Cc: guix-devel

Hi,

Greg Hogan <code@greghogan.com> skribis:

> Is there a best practice or example for building a library twice, both
> static and dynamic? I submitted patch #43620, and in working on
> another library have the same issue. These are cmake builds with a
> parameter declaration for either a static or dynamic build, not
> both. I would like to create a single package with both “out” and
> “static” outputs, which looks to be standard across Guix.

Yes, a “static” output is the preferred method if you want to keep .a
files around.

> One idea is to run the configure / make / make install phases
> twice. modify-phases does not currently support copying phases (though
> add-after could work with the right function reference from
> cmake-build) and #:configure-flags would need to be set differently.

Build systems from Autoconf/Automake/Libtool and those using CMake can
produce both shared libraries (position-independent code, PIC) and
static libraries at once.  No need to run it twice.

HTH,
Ludo’.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-10-05 13:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-09-27 11:57 Building a library as both static and dynamic Greg Hogan
2020-09-29  5:09 ` Efraim Flashner
2020-10-05 13:39 ` Ludovic Courtès

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).