Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

When one writes an open-source project and uses Google Code or GitHub, and wants to use a library like Lua, how should one do this?

  • Should the dependency be included in the repository?
  • Should the dependency be built from within the same build script as the rest of the project, or from a separate build script?

Given that the library doesn't need installation before compilation.

share|improve this question
add comment

5 Answers 5

up vote 6 down vote accepted

I would highly recommend reading through Git's documentation on submodules; it addresses this very problem, assuming that all of your sources use Git. If they don't, you can always set up a git repo for the purpose of integration. The effort is trivial, and the payoff is significant.

share|improve this answer
    
Submodules is rather weak implementation of dependency-management in common and in Git. At least git subtree is a lot better iteration –  Lazy Badger Jan 21 '13 at 6:18
add comment

Should the dependency be included in the repository?

I think dependencies should always be included in the repository as long as including them does not violate any terms of use. Few things are more annoying than having to find the right versions of the right dependencies manually before you can make a build. Sure, this is easy when you have automated tools to do this for you, which can find and download the right dependency, but what if you aren't connected to the web at the moment or the server is down or the project of the dependency has been discontinued completely and taken offline? Always include the dependencies if possible.

Should the dependency be built from within the same build script as the rest of the project, or from a separate build script?

Unless there's a good reason to compile from source, use precompiled versions.

And why not provide options in the build script? A simple switch to choose whether the dependencies should also be compiled or not. If the user chooses to compile the dependencies as well, then just invoke their very own build scripts from your product's build script. So the user can invoke the dependcies' build scripts manually or choose to create a full build of everything. But I'd just deliver the dependencies as binaries if there's not a good reason to compile them from the sources. I think in the Open Source world, some licenses require you to distribute the sources along with your product but that does not mean you can't have them precompiled.

In short: Provide a whole standalone, working package if possible. This will provide the most convenience to your users.

share|improve this answer
    
The general situation in open-source land seems to contradict you - anything I've compiled from source so far came with a list of required dependencies which I had to install first; OTOH, anything that's part of an OS distribution can use the package manager to do this work for you. –  tdammers Sep 23 '11 at 0:21
    
Git submodules can be a solution to this problem. –  Andrew Finnell Sep 23 '11 at 0:49
    
@tdammers: I know, if your installing software on a linux system the package manager does all the work for you. But that requires an internet connection and the package must be in a certain format and I explicitly stated that automation tools can help with this. You can't use such a system for .NET open source tools, for example. If you take a look at sourceforge tools like NHibernate or Castle Windsor, then you'll see that all dependencies are inlcuded as binaries. And that's the only reasonable thing to do. –  Falcon Sep 23 '11 at 8:14
    
@tdammers: Conincidentally, I have to install the OpenOffice SDK on a linux machine here today. Since the SDK cannot be installed via the package manager, I grabbed the RPM from the website. What do you think is the first message I get when trying to run "rpm --install" ? error: Failed dependencies: ooobasis3.3-core01 is needed by ooobasis3.3-sdk-3.3.0-9567.x86_64 - OH JOY! –  Falcon Sep 23 '11 at 9:16
    
If you install outside of the package manager, then the source package should contain a list of requirements (usually in README); these are either part of the mainstream distributions (so all you need to do is feed the list to your package manager), or there should be instructions on where to get them. The reason it is done this way is that including various subversions of various dependencies in each and every package you install will produce dependency hell in no time, and it's also extremely redundant. –  tdammers Sep 24 '11 at 6:55
show 3 more comments

This may or may not apply to your use case, but what we do at work is include a "References" folder in each branch. We place 3rd party DLLs in here. This causes a lot of duplication of relatively unchanging binaries in source control, but storage is cheap and at any point each branch & tag has exactly the dependencies (and version!) it's expecting.

We pre-compile the dependencies ourselves and move the compiled binaries into that folder. Our own in-house shared library is treated this way as well. That way the same technique works for pre-compiled proprietary libraries, open-source libraries, and in-house libraries.


As far as actually answering your question now that I've re-read it, do the same thing, and just mention that your project uses a precompiled 1.3.5 version of Lua.

share|improve this answer
add comment

Being an Eclipse shop, we have just started using Buckminster to manage our build/assemble/deploy process.

Our first stage has been to pull out all of our existing dependent libraries and let buckminster take care of materialising the correct ones. This makes for a much quicker and smaller deployment.

The next step will to move our monolithic svn repository to a series of modular git repositories.

I don't know how well buckminster would integrate with git submodules (or mercurial subrepos for that matter), but it is nice that buckminster is agnostic with regard to the VCS used for any given component.

share|improve this answer
add comment

Should the dependency be included in the repository?

It can be referenced in repository (by any usable for SCM method), if this dependency is integral part of product (source-dependence), not binary-dependence, which can be resolved separately

Should the dependency be built from within the same build script as the rest of the project, or from a separate build script?

Doesn't matter at all. You can prefer any method, according to your requirements (speed/transparency/manageability/etc)

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.