Damn it, I knew I missed a file to send.

It's basically just a shim that passes on --sysroot= if $SYSROOT is set,
as it was the only way I found for some parts of the build to get the
sysroot.

I initially wrote it after I got past stage 1 to build stage 2, which
since it would not be an aarch64 binary, in the script comments, I
express confusion about why it didn't break the stage 1 build,

I just realised now it's because of the name, it would only be used on
the parts of the build where an aarch64 cross-compiler is needed, that's
the whole point. I clearly needed to sleep when I was writing that.

I also have an aarch64-unknown-openbsd-cpp which just calls cc with -E.
I don't recall why this one was needed, but I do recall it fixed some
breakage, although that doesn't mean it's still needed now that much
of the build steps have changed since then as I've been experimenting
(either way, configure will autodiscover the CPP in the same folder if
you give it the CC).

Both are so small, I'm just gonna inline them in this email, no
attachments.

bin/aarch64-unknown-openbsd-cc:

#!/usr/bin/env sh

if [ -n "$SYSROOT" ]; then
  clang --sysroot="$SYSROOT" "$@"
else
  clang "$@"
fi

bin/aarch64-unknown-openbsd-cpp:

#!/usr/bin/env sh

clang -E "$@"

I've fixed the script to create the bin directory and print both those
codes into their respective files, and I'll attach that new script to
keep it up to date. I've also removed the comment expressing confusion
about why the cc shim doesn't break stage 1 :).

Attachment: build-ghc-9.10.1-for-openbsd-arm64-on-openbsd-7.6-amd64.ksh
Description: Binary data


Cheers,
Habib

On 12 Nov 2024, at 05:05, Greg Steuck <gne...@openbsd.org> wrote:

حبيب محمد الأمين محمد الهـاد <ha.ala...@gmail.com> writes:

I've been keeping the commands in a shell script, though I was still
a bit surprised it worked to get to the same point first try. I was
running the commands manually, as the script didn't fetch the sources,
extract the sysroot, etc.

Thanks for the detailed script. I can tell you put a lot of work into
this. I think a step is still missing as the recipe references a
cross-compiler which isn't there in ghc source directory by default.
The script has this CC which isn't there:

env \
 SYSROOT= \
 CC="$PWD/bin/aarch64-unknown-openbsd-cc" \
...
 ./configure
...

Do you recall where this should come from?

Thanks
Greg

Reply via email to