Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Should I include configure and makefile in a github repository?

We recently moved from subversion to git, and then to Github, for several open source projects. Github was nice in that it provided a lot of functionality. One of the things I particularly like is the ability to download tags as zip or .tar.gz files.

Unfortunately Github recently discontinued downloads. That shouldn't be a problem because of the ability to download tags. However in the past we have not put a Makefile , configure script or any other autoconf-generated files into the repo because they get lots of conflicts when people merge.

What's the proper way to handle this?

  • Should I put autoconf and automake-generated files in the repo so people can download tags directly?
  • Or should there be a bootstrap.sh file and people are told to run that?
  • Or should I just do a make dist and put that into the repo?

Thanks

like image 930
vy32 Avatar asked Apr 01 '13 14:04

vy32


People also ask

Should Makefile be in git?

No, you absolutely should not put Makefile.in in your git repo. Yes, you absolutely should include it with your distribution. As a corollary, you should not be using git as your distribution mechanism. (That's what tarballs and rpms are for.)

What should I not put in git?

You shouldn't store credentials like usernames, passwords, API keys and API secrets. If someone else steals your credentials, they can do nasty things with it.

What is Makefile in GitHub?

# A Makefile is a collection of rules. Each rule is a recipe to do a specific. # thing, sort of like a grunt task or an npm package. json script. #

What should I not upload to GitHub?

Broadly speaking, you should not upload on github following: any content which does not legally belong to you, and which has no some open source license. content which could be generated (e.g. object files).


2 Answers

Publish the output of make dist via GitHub Releases

Your first option—putting the Autoconf- and Automake-generated files into the repository—is not a good idea. It's almost never beneficial to store generated files in source control. In this case, it's going to pollute your history with a lot of unnecessary and potentially conflicting commits, particularly if not all your contributors are using the same version of Autotools. Your third option—checking in the output of make dist—is a bad idea for exactly the same reasons as the first option.

Your second option—adding a "bootstrap" script that calls Autoconf and Automake to generate the configure scripts—is also a bad idea. This defeats the entire purpose of Autotools, which is to make your source portable across systems—including those for which Autotools is not available! (Consider what would happen if someone wanted to build and install your software on a machine on which they don't have root access, and where the GNU Build System is not installed. A bootstrap script is not going to help them because they'd first need to make a local installation of Autotools and possibly all its dependencies.)

The proper way of releasing code that uses Autotools is to produce a tarball with make dist (or better yet, make distcheck, since this will also run tests and do other sanity checks), and then publish this tarball somewhere other than the source repository.

Your original question, from April 2013, states that GitHub discontinued download pages. However, in July 2013, GitHub added a "Releases" feature that not only pre-packages your source tags, but also allows you to attach arbitrary files to each release. So on GitHub, the Releases page is where you should publish your make dist tarballs (and preferably also the detached GnuPG signatures of them).

Basic steps

  1. When you are ready to make a release, tag it and push the tag to GitHub: $ git tag 1.0 # Also use -s if desired $ git push --tags
  2. Use your Makefile to produce a tarball: $ make dist # Alternatively, 'make distcheck'
  3. Visit the GitHub page for your project and follow the "releases" link: Screenshot of a GitHub project showing the location of the releases link
  4. You will be taken to the Releases page for your project. The first time you visit, all you will see is a list of tags and automatically produced tarballs from the source tree: GitHub Releases page Press the "Draft a new release" button.
  5. You will then be presented with a form in which you should fill in the Git tag associated with the release and an optional title and description. Below this there is also a file selector labelled "Attach binaries by dropping them here or selecting them". Use this to upload the tarball you created in Step 2 (and maybe also a detached GnuPG signature of it). Drafting a GitHub release When you're done, press the "Publish release" button.
  6. Your project's Releases page will now display the release, including prominent download links for the attached files: Completed GitHub release page

If you don't want to use GitHub Releases, then as pointed out in a previous answer, you should upload the tarballs somewhere else, such as your own website or FTP site. Add a link to this repository from your project's README.md so that users can find it.

like image 186
Psychonaut Avatar answered Oct 11 '22 15:10

Psychonaut


The second is better: you want any user of your repo to be up and running as fast as possible, re-generating what he/she needs in order to build your program.

Since Git is very much a version control for text (as opposed to an artifact repo like Nexus), providing a way to generate the final binary is the way to go.

like image 39
VonC Avatar answered Oct 11 '22 15:10

VonC