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

Make build more GNU conformant and reproducible #3

Merged
merged 1 commit into from
Jan 2, 2024
Merged

Make build more GNU conformant and reproducible #3

merged 1 commit into from
Jan 2, 2024

Conversation

davidpolverari
Copy link
Contributor

Most GNU/Linux distributions' packaging build toolchains are centered around Makefiles that follow GNU Makefile conventions, such as supporting staged installs (via the DESTDIR variable), for example, besides honoring {CPP,C,LD}FLAGS.

Other concern modern distributions have regard reproducible builds [1]. To make a build reproducible, the build system needs to be made entirely deterministic. For example, the current date and time must not be recorded and output must always be written on the same order.

This patch makes the OpenMRac Linux build more GNU conformant (enough for the Debian packaging build toolchain) and deterministic, by appending to *FLAGS instead of overwriting them in the former case, and by sorting he object file list in the latter.

[1] https://reproducible-builds.org/

Most GNU/Linux distributions' packaging build toolchains are centered
around Makefiles that follow GNU Makefile conventions, such as
supporting staged installs (via the DESTDIR variable), for example,
besides honoring {CPP,C,LD}FLAGS.

Other concern modern distributions have regards reproducible builds [1].
To make a build reproducible, the build system needs to be made entirely
deterministic. For example, the current date and time must not be
recorded and output must always be written on the same order.

This patch makes the OpenMRac Linux build more GNU conformant (enough
for the Debian packaging build toolchain) and deterministic, by
appending to *FLAGS instead of overwriting them in the former case, and
by sorting he object file list in the latter.

[1] https://reproducible-builds.org/
Copy link
Owner

@Franticware Franticware left a comment

Choose a reason for hiding this comment

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

  1. paths in the deb target might need adjusting as per the updated data path prefix
  2. also, I believe the deb package would be worth separating into two - executable and data, but I will leave this to a Debian packaging expert (possibly yourself?) and I totally don't require it for this PR to be approved
  3. I will have to check Debian packages for OpenMRac, if they don't use the deb target, it might be worth removing it altogether.

@Franticware Franticware merged commit b734a2d into Franticware:main Jan 2, 2024
@davidpolverari
Copy link
Contributor Author

davidpolverari commented Jan 2, 2024

  1. paths in the deb target might need adjusting as per the updated data path prefix

I will have a look at it. During packaging, we usually make the minimum required changes for the package to build according to Debian Policy. Thus, I hadn't touched other parts of the Makefile (such as the deb target), as they were not used for the Debian build. We tend to contribute the patches we use back to minimize the differences between Debian packaging and upstream, but sometimes our changes might be not enough for upstream maintainers.

That said, I will try to adjust it as soon as I have spare time.

2. also, I believe the deb package would be worth separating into two - executable and data, but I will leave this to a Debian packaging expert (possibly yourself?) and I totally don't require it for this PR to be approved

Oh, it already is. I packaged both openmrac-data and openmrac, which depends on the former.

3. I will have to check Debian packages for OpenMRac, if they don't use the deb target, it might be worth removing it altogether.

I didn't use the deb target during packaging.

PS: I posted after you had merged the PR :). Thanks!

@davidpolverari davidpolverari deleted the gnu-compliant-makefile branch January 2, 2024 21:39
@Franticware
Copy link
Owner

Please check my latest commit if it seems roughly OK (i.e. I didn't break anything vital for Debian packaging). Thanks.

@davidpolverari
Copy link
Contributor Author

Please check my latest commit if it seems roughly OK (i.e. I didn't break anything vital for Debian packaging). Thanks.

LGTM. Now that we are using /usr/local as the default prefix, it shouldn't break anything when installed from source with default settings.

About the openmrac-es2 package, I don't think it is needed. For instance, in my desktop PC, I can select between OpenGL Compat. profile, OpenGL ES 2 and OpenGL 3.3 from the settings dialog, and it works with OpenGL ES 2 just fine. If an ARM user whishes, they can install the required OpenGL ES 2 runtime support libs without the need to change anything. Maybe that could be told in the README?

@Franticware
Copy link
Owner

Concerning ES2 support package, I am unfamiliar with the methods you are describing. The Makefile.linux-es2 links against libGLESv2 instead of libGL which makes it foolproof IMO. Also, there are slight tweaks to shaders and GL functions too, the two libraries don't map 1:1. The package idea was inspired by e.g. https://manpages.ubuntu.com/manpages/focal/man1/glmark2-es2.1.html

As an example of SBC issues, many games linked against libGL run badly or crash right away on StarFive VisionFive 2 provided Debian image. On the other hand, OpenMRac built with Makefile.linux-es2 ran fine.

I believe Desktop GL with ES2 profile and linking to actual ES2 library are two different things.

Let's keep this question pending for now.

@davidpolverari
Copy link
Contributor Author

Concerning ES2 support package, I am unfamiliar with the methods you are describing. The Makefile.linux-es2 links against libGLESv2 instead of libGL which makes it foolproof IMO. Also, there are slight tweaks to shaders and GL functions too, the two libraries don't map 1:1. The package idea was inspired by e.g. https://manpages.ubuntu.com/manpages/focal/man1/glmark2-es2.1.html

As an example of SBC issues, many games linked against libGL run badly or crash right away on StarFive VisionFive 2 provided Debian image. On the other hand, OpenMRac built with Makefile.linux-es2 ran fine.

I believe Desktop GL with ES2 profile and linking to actual ES2 library are two different things.

Let's keep this question pending for now.

You're right. I didn't think enough about it as I was answering your comment. I will think about that approach when I manage to get some time to work on it.

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.

None yet

2 participants