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

produce configure-generated files using build options and target settings rather than hard-coding #1

Closed
andrewrk opened this issue Jan 11, 2023 · 4 comments
Labels
bug Something isn't working enhancement New feature or request

Comments

@andrewrk
Copy link
Collaborator

andrewrk commented Jan 11, 2023

The commit af01e2d copied configure-generated source files into the repo. These are incorrectly hard-coded with the settings of the host when ./configure was evaluated. Instead, all these files should be generated by build.zig at build time.

In addition to the commit listed above:

  • libavutil/ffversion.h
@andrewrk andrewrk added bug Something isn't working enhancement New feature or request labels Jan 11, 2023
@david-vanderson
Copy link

I am trying to fix this, but need guidance.

I tried (and failed) to get build.zig to create the .c files inside zig-cache and then add those to the C sources. Is there a way to do this? Or should build.zig create the files where they normally reside and reference the normal paths?

For the headers I was planning on replacing them with empty files in git, and putting all the #defines in build.zig. Sound right?

@andrewrk
Copy link
Collaborator Author

For the headers, you could try something like this:

https://github.com/andrewrk/libmp3lame/blob/497568e670bfeb14ab6ef47fb6459a2251358e43/build.zig#L8-L116

More enhancements to std.build will be needed to additionally install such a generated header.

As for .c files, all of these things need to be done in a declarative manner with the build system. Perhaps std.build.LibExeObjStep needs to gain a new method similar to addCSourceFile but that accepts a WriteFileStep as a parameter.

@david-vanderson
Copy link

First start on the headers part here ziglang/zig#14382

@david-vanderson
Copy link

Thanks for the guidance! That helped me understand where to start.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants