Skip to content

update nodejs portfiles, enable ccache, use macports libraries where possible #28819

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 26 commits into
base: master
Choose a base branch
from

Conversation

i3roly
Copy link

@i3roly i3roly commented Jul 7, 2025

please see my follow-up to @ryandesign's ticket here:

https://trac.macports.org/ticket/71475#comment:17

as it stands, with the forthcoming pull this is the status:

  1. nodejs14->nodejs20 will build/run properly on all macs that have a newer libuv (i'm on 10.14, so i dunno where the line is)
  2. nodejs14->nodejs18 will build/run properly on all macs from 10.7 and newer
  3. whilst the logs on the ticket aren't showing ccache, i did test it on nodejs18 on lion (as we speak) and it looks fine. i see no reason why ccache should cause a problem.

the outstanding issues are now:

  1. fixing libuv for nodejs20->nodejs22 on older macs
  2. fixing/updating macports-libcxx so more-recent macs (like 10.14 machines) can run nodejs22
Type(s)
  • bugfix
  • enhancement
  • security fix
Tested on

macOS 10.7.5 11G63 x86_64
Xcode 4.6.2 4H1003

Verification

Have you

  • followed our Commit Message Guidelines?
  • squashed and minimized your commits?
  • checked that there aren't other open pull requests for the same change?
  • referenced existing tickets on Trac with full URL in commit message?
  • checked your Portfile with port lint?
  • tried existing tests with sudo port test?
  • tried a full install with sudo port -vst install?
  • tested basic functionality of all binary files?
  • checked that the Portfile's most important variants haven't been broken?

@macportsbot
Copy link

Notifying maintainers:
@ci42 for port nodejs14, nodejs16, nodejs18, nodejs20, nodejs22.

@i3roly
Copy link
Author

i3roly commented Jul 8, 2025

added libuv @ryandesign

i hate git so much. you guys can deal with this nonsense.

building nodejs20 on lion while i pass out

later

i3roly added 4 commits July 8, 2025 05:23
this is a well-known bug on lion that relates to posix_spawn and
FD_CLOEXEC, which only works on 10.8 and above (maybe 10.6 too, not
sure)
@i3roly
Copy link
Author

i3roly commented Jul 8, 2025

provided nodejs20/zettlr build log to show the panic issue has been fixed.

i would appreciate any contributor's adjustments to the version macros to ensure they're working right.

in short, for libuv:

  • the sendmsg_x recvmsg_x calls should only be compiled for 10.15 and higher
  • the FD_CLOEXEC flag for posix spawn should only be included for 10.8 and higher.

i3roly added 2 commits July 8, 2025 07:48
seems to work by using an older-style.

also use the CloseallFDsOnExec that originated in chrome, which will
close all FDs after execution. though they say it's not safe in
multithreaded applications, it worked for quite some time and is better
than nothing.

all that's left is ensuring clang-19 uses the latest ld throughout.
seems to call ld127 at the end :/
- also make all systems use the up-to-date macports libuv, for
  uniformity.
@casr
Copy link
Contributor

casr commented Jul 12, 2025

@i3roly Potentially some of what you're bringing up here was solved in #27671 if you want to give it a test?

i3roly added 2 commits July 12, 2025 08:48
since there's some discussion as to whether libuv or libuv-devel will be
getting the update, i have copied the patch to both versions.

as it stands a newer libuv is needed for some ports. it may make sense
to just use libuv-devel for node at this time.
i3roly added 2 commits July 16, 2025 07:24
it looks like buildbot already takes care of this or something?
Copy link
Contributor

@ryandesign ryandesign left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are only the things that stood out to me in your nodejs14 changes. I didn't look at the other ports.

file mkdir ${workpath}/zlib-inc ${workpath}/cares-inc
file copy ${prefix}/include/zconf.h ${prefix}/include/zlib.h \
${workpath}/zlib-inc/
system "cp ${prefix}/include/*ares*.h ${workpath}/cares-inc"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's preferable to use native Tcl code when possible instead of using system. In this case, this can probably be done with (untested):

Suggested change
system "cp ${prefix}/include/*ares*.h ${workpath}/cares-inc"
copy {*}[glob ${prefix}/include/*ares*.h] ${workpath}/cares-inc

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

whoops i thought i had incorporated this, but i'll do this at the end with the outstanding libuv 'tarball' -> release change


# V8 only supports ARM and IA-32 processors
supported_archs i386 x86_64 arm64

universal_variant no

# "V8 doesn't like cache."
configure.ccache no
configure.ccache yes
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the default; you could remove this line.

Suggested change
configure.ccache yes

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dun

depends_lib-append path:lib/pkgconfig/icu-uc.pc:icu \
port:python${py_ver_nodot} \
port:zlib
path:lib/libz.dylib:zlib \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unless something changed while I wasn't looking, the zlib port is the only port that installs lib/libz.dylib, so there's no reason to change port:zlib to path:lib/libz.dylib:zlib.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dun.

and you were right: it was a nodejs issue. seems certain versions had this header, but older and newer ones did not lol. so typical of these guys lol

port:zlib
path:lib/libz.dylib:zlib \
path:lib/libuv.dylib:libuv \
port:openssl \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This port includes the openssl portgroup so you're not supposed to have to include the openssl dependency yourself; the portgroup does it for you.

Suggested change
port:openssl \

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dun

Comment on lines 131 to 132
configure.args-append --shared-openssl-includes=${prefix}/libexec/openssl3/include/openssl
configure.args-append --shared-openssl-libpath=${prefix}/libexec/openssl3/lib
Copy link
Contributor

@ryandesign ryandesign Jul 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This port includes the openssl portgroup so it was correct to use its functions to get the include and library paths; that should not have been changed.

Suggested change
configure.args-append --shared-openssl-includes=${prefix}/libexec/openssl3/include/openssl
configure.args-append --shared-openssl-libpath=${prefix}/libexec/openssl3/lib
configure.args-append --shared-openssl-includes=[openssl::include_dir]
configure.args-append --shared-openssl-libpath=[openssl::lib_dir]

Since it looks like you want to switch from openssl 1.1 to 3, change this line near the top of the Portfile:

openssl.branch          1.1

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i actually didn't care what openssl version was used, but you are right i should just use the macros that come with the portgroup. so that's what i did.

i didn't change openssl's inclusion otherwise.

set py_ver 3.10
set py_ver_nodot [string map {. {}} ${py_ver}]

depends_build-append port:pkgconfig
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The build is failing because python310 was not found.

Suggested change
depends_build-append port:pkgconfig
depends_build-append port:pkgconfig \
port:python${py_ver_nodot}

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dun

revision 1
checksums rmd160 40cf693021f7584ff4aeffcbf2020d0e00139005 \
sha256 2ceca1a7577633cf92794db5bf5512370f6cd45a5746d6e14f8c20aeab0a547b \
size 1691252
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't look like it's aligned correctly, and it has trailing whitespace.

Suggested change
size 1691252
size 1691252

However, please follow the instructions in the comment and change github.tarball_from from tarball to either releases or archive, whichever is correct for this software; then the checksums will change again.

Since you are increasing the version, the revision should be 0.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i will do this change at the very end because of the volume of other things that were changed.

like the star on the top of the tree, we will put it on together, my dear rydye @ryandesign

@ryandesign
Copy link
Contributor

Responding to the question you asked in a commit message:

remove autoreconf command for libuv-devel
it looks like buildbot already takes care of this or something?

Buildbot and GitHub Actions run MacPorts. MacPorts does not automatically use autoreconf. If this software needs autoreconf to be done, or if you are patching files that comprise an autoconf-based build system, the portfile must run autoreconf.

@i3roly
Copy link
Author

i3roly commented Jul 17, 2025 via email

thanks pal.

proud to announce the new spiffy macports-libcxx holds up well to all of
the nodejses, unlike the existing one which cannot cope with the lack of
__cxa_thread_atexit, whereas mine, whilst not fully there (i would like
the symbol pulled automatically from the dylib instead of shoehorning in
the static), can pull the symbol out of the static libcxxabi.
well, i blew it because i didn't put in ${prefix} instead of /opt/local
when linking libc++abi.a, so i have to hope this is the star on the tree
commit

here's to hoping it works
this is more of a 'touch' commit than anything, because buildbot reports
macos 13 building fine, so i don't know why 14/15 wouldn't also be okay
unless it has to do with my decision to force update stale commits.

so here is a fresh commit to see if clears buildbot's confusion
@i3roly
Copy link
Author

i3roly commented Jul 18, 2025

everything looks good @ryandesign
i have no idea why it failed on 14/15, but it looks like a header clash?

maybe it was my decision to amend previous commits that previously were missing things.

i just pushed a fresh commit to rule this out. i don't see why 14/15 would have errors if 13 is ok.

i3roly added 2 commits July 18, 2025 10:40
yes yes rydye @ryandesign i may have missed the slightly-different patch
for nodejs16, and i may have forgotten the include directives for zlib
on nodejs24, which probably would explaint he failures on both

hoping for all green baby let's go
i3roly added 2 commits July 18, 2025 16:03
whatever

CMON LET'S GO ALL GREEN

i got a few tracks queued up for the occasion, rootie @jmroot
there was "regression" in clang20 at some point, and i assume the
snapshot of APPUL clang contained it, as the other two don't fail on
nodejs24 (well, at least 15 doesn't on the last run).

so we force clang-19 on macos15 for nodejs24.

rootie @jmroot if this finishes when i'm in bed (and you'll obviously be up and
at it), wait to crack those Fosters kegs

cc @ryandesign
i3roly added 2 commits July 19, 2025 01:18
clang-mp-19

here's to hoping. the only outstanding issue is macos14 and nodejs24
hoping this works. otherwise i need your input @ryandesign as to how to
force nodejs24+macos14 to use clang-mp-19. i assume i should have been
using configure.{cc,cxx,cpp} to force them all along, and not
compiler.blacklist
@i3roly
Copy link
Author

i3roly commented Jul 19, 2025

rootie @jmroot is that Fosters on ice? has it even arrived?

JET

i guess i can use Jet - Hey kids as the pre-drink/primer.

cc @ryandesign looks like we good to go fam.

time to flip them switches like daz and kurupt and get this show ROLLIN'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

5 participants