Void Linux discussion
 help / color / mirror / Atom feed
* Statically compile libraries into packages
@ 2015-07-28  8:28 Stefan Mühlinghaus
  2015-07-28  8:37 ` Juan RP
  2015-07-28 15:58 ` Stefan Mühlinghaus
  0 siblings, 2 replies; 3+ messages in thread
From: Stefan Mühlinghaus @ 2015-07-28  8:28 UTC (permalink / raw)
  To: voidlinux


[-- Attachment #1.1: Type: text/plain, Size: 355 bytes --]

Is there an intended way to statically compile a library into a package?

I'd usually compile the library first, copy the resulting .a and header 
files over to the actual programs sources, maybe adapt the makefile a 
little and then compile it. This seems somewhat unelegant and I wonder if 
maybe xbps-src has some mechanism to aid with this situation.

[-- Attachment #1.2: Type: text/html, Size: 400 bytes --]

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

* Re: Statically compile libraries into packages
  2015-07-28  8:28 Statically compile libraries into packages Stefan Mühlinghaus
@ 2015-07-28  8:37 ` Juan RP
  2015-07-28 15:58 ` Stefan Mühlinghaus
  1 sibling, 0 replies; 3+ messages in thread
From: Juan RP @ 2015-07-28  8:37 UTC (permalink / raw)
  To: voidlinux, master...; +Cc: master...


[-- Attachment #1.1: Type: text/plain, Size: 406 bytes --]

This really depends if the software build system is prepared for static 
builds, but in 75% of
packages you can accomplish this by setting CFLAGS and LDFLAGS like so:

$ printf 'CFLAGS="-static"\nLDFLAGS="-static"\n' >> srcpkgs/grep/template

If you want to make this permanent it would be better if you conditionalize 
those settings
in a `static` build option, as has been done already in some packages.

[-- Attachment #1.2: Type: text/html, Size: 480 bytes --]

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

* Re: Statically compile libraries into packages
  2015-07-28  8:28 Statically compile libraries into packages Stefan Mühlinghaus
  2015-07-28  8:37 ` Juan RP
@ 2015-07-28 15:58 ` Stefan Mühlinghaus
  1 sibling, 0 replies; 3+ messages in thread
From: Stefan Mühlinghaus @ 2015-07-28 15:58 UTC (permalink / raw)
  To: voidlinux; +Cc: master...


[-- Attachment #1.1: Type: text/plain, Size: 945 bytes --]

What I'm trying to achieve is build a package for program X that depends on 
library Y. Making another package for Y is not feasible because in this 
particular case X needs a very specific and/or outdated version of Y. So I 
want to construct the package template for X in such a way that it 
downloads and builds both distfiles for X and Y and then statically links 
them together so that the target system is not cluttered with library 
garbage.

I'm pretty sure I can make that work by copying files around in the working 
directory and patching the Makefile of X. It would be somewhat more elegant 
if I could "install" the statically compiled library of Y and its 
header-files to some temporary lib/include directory on the building system 
which would automatically be used when compiling X and afterwards cleaned.

I of course realize that this is a somewhat esoteric use-case but I thought 
I'd better ask before doing it manually :) 

[-- Attachment #1.2: Type: text/html, Size: 1025 bytes --]

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

end of thread, other threads:[~2015-07-28 15:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-28  8:28 Statically compile libraries into packages Stefan Mühlinghaus
2015-07-28  8:37 ` Juan RP
2015-07-28 15:58 ` Stefan Mühlinghaus

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 NNTP newsgroup(s).