Compiling a port statically

Bill Cole macportsusers-20171215 at billmail.scconsult.com
Sun Dec 6 22:20:45 UTC 2020


On 6 Dec 2020, at 10:31, Riccardo Mottola via macports-users wrote:

> Hi,
>
>
> On 12/5/20 8:07 AM, Ryan Schmidt wrote:
>>> Obviously the block would need some tweaking for a given port, it 
>>> gives the idea.
>> I can't think of a reason why we would want to offer such a thing.
>>
>
> I can think of two scenarios:
>
> - building "always safe" binaries which can be used at system level, 
> e.g. login shells, tools, things put in launchd. That is things you 
> want to always work, even if you are during a MacPorts upgrade. NetBSD 
> offers two packages for the same thing, e.g. bash and bash-static, 
> IIRC. perhaps in MacPorts it could be a "variant"?

That's how it is implemented in the bash Portfile Ken linked to.

Despite coming up with that hack (circa 2014) I agree with Ryan that it 
does not belong in the official version of any Portfile. For one thing, 
it is not quite accurate that it creates a completely static binary, as 
that's not really feasible on any version of MacOS because Apple does 
not provide a static libSystem. It DOES create a build of bash that is 
usable as /bin/sh, because it does not require any dynamic library which 
the OS can run without. The only sound reason to do that is if you are 
reckless enough to expose an obsolete version of MacOS to possible 
sources of ShellShock attacks. Because of the versioning headaches Ryan 
described, adding static(ish) variants to MacPorts is asking for 
trouble.

-- 
Bill Cole
bill at scconsult.com or billcole at apache.org
(AKA @grumpybozo and many *@billmail.scconsult.com addresses)
Not Currently Available For Hire


More information about the macports-users mailing list