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
Change: When building NewGRFs, use grfid (from grfcodec) to calculate NewGRF MD5 hash. #11492
Conversation
Might be simpler to generate md5 file only if cmake has found grfcodec (using grfid that comes with it) and store the md5 file in repo for when grfcodec is not found (like we do for the grf themselves). |
What is a bit missing in the motivation, is why you want to do this. I kinda deduce that you want to upgrade from v1 to v2? Maybe for the history add a few words in the description why that is something we would like. Not disgreeing, to be clear, I was just missing the reason why :) Edit: ah, seems #11491 is related to this PR :) Guess that caused it ;) |
Now updated to just use grfid from grfcodec only when building the NewGRFs as well. Still a bit of wrangling going on but at least there's no code being duplicated. |
… NewGRF MD5 hash. This allows for v2 container NewGRFs to be created. Hashes are needed for building the baseset metadata, so the .hash files are stored the source tree so they can be built if grfcodec and grfid are not present. The hash of openttd.grf is not actually needed, but it is simpler to leave it in than handle only orig_extra.grf.
Motivation / Problem
#11491 adds 32bpp sprites to the extra data NewGRF, which requires it to be built as container v2, but our build scripts do not correctly calculate the MD5 hash for container v2 NewGRFs.
Baseset.cmake
uses CMake's built in MD5 function to calculate the hash oforig_extra.grf
. However hash calculation only works for v1 container grfs.The tool
grfid
from grfcodec can be used to calculate both v1 and v2 hashes, however grfcodec isn't currently a build dependency.Description
Vendor grfid (with some changes due to our updated Md5 implementation and use of fmt, and use it in the build process.Switch to NewGRF container v2. A side effect of this is that the files are a about 10% larger.Update the build system to use grfid from grfcodec to calculate the hash of the custom NewGRFs. This requires a bit more effect than before as MD5 was a nice cmake built-in. The hash is written to a file which is stored in the source tree to enable OpenTTD to be compiled if grfcodec is not present.
Limitations
I removed the copyright message on grfid -- it's my name but I never put that there, so...Checklist for review
Some things are not automated, and forgotten often. This list is a reminder for the reviewers.