Skip to content
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

Ports/file: Build host version to ensure we can properly cross compile #24326

Merged
merged 1 commit into from
May 22, 2024

Conversation

supercomputer7
Copy link
Member

@supercomputer7 supercomputer7 commented May 14, 2024

We should build file natively as well so it can be used to compile the target build (for serenity). The Makefile doesn't do this automatically so to ensure it will not fail due to version mismatch between the host version and target version, we ensure we always have a native binary at hand.

Some funny backstory - I looked on the Internet something related to bashisms and dash, and was interested to see the state of the dash port, and (surprise surprise) I saw it did the host_env trickery @timschumi suggested to do and simply copied the procedures and changed it a bit to work according to the README.DEVELOPER guidelines in the port.

Closes #18415.

@supercomputer7 supercomputer7 added the 👀 pr-needs-review PR needs review from a maintainer or community member label May 14, 2024
Copy link
Member

@timschumi timschumi left a comment

Choose a reason for hiding this comment

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

Dash really isn't the best example regarding the ports script code quality, we have since found better ways to express certain constructs. I'd recommend something like the following instead (untested, but you get the idea):

function pre_configure() {
    host_env
    mkdir -p "host-build"
    (
        cd host-build
        "../${workdir}/configure"
        make
    )
    target_env  # Not sure if this is required
}

export FILE_COMPILE_DEP="${PORT_BUILD_DIR}/host-build/src/file"

This allows us to keep the target build steps unchanged, and doesn't add as much subshell boilerplate code.

Ports/file/package.sh Outdated Show resolved Hide resolved
Ports/file/package.sh Outdated Show resolved Hide resolved
We should build file natively as well so it can be used to compile the
target build (for serenity). The Makefile doesn't do this automatically
so to ensure it will not fail due to version mismatch between the host
version and target version, we ensure we always have a native binary at
hand.
@timschumi timschumi merged commit 5b17091 into SerenityOS:master May 22, 2024
12 checks passed
@github-actions github-actions bot removed the 👀 pr-needs-review PR needs review from a maintainer or community member label May 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ports: Building "file" fails due to version mismatch
2 participants