Thread: How to distribute code

  1. #1
    Registered User
    Join Date
    Dec 2007
    Posts
    9

    How to distribute code

    I'm writing some software for Linux that I'd like to make freely available for others on my webpage. Its image processing software specific for astronomy. I'm not at all experienced with packaging and distributing code. So here's my main question:

    My code requires the libpng and libtiff libraries. How should I handle this? Should I package these libraries with my own code and distribute it together? I assume a better approach would be to package my code separately and then tell any user they need to have the libtiff and libpng development libraries installed for their distro.

    Also most other packages have a configure script. What's the best way to create this so that the user can just do the normal ./configure, make, make install.

    I use Kdevelop but I'm pretty new to IDE's. In the past I was only programming for myself and therefore just typed up my code and used gcc.

    I'm also considering a CVS type thing for my code so others can contribute and help with my deficiencies. Any recommendations on how to do this. I have my own server but I'm also aware there are sites that can host this for me. I have no prior experience with CVS but willing to learn.

    Anyone know of a good beginners guide for these issues?

    Thanks
    Last edited by JBull; 01-26-2008 at 09:42 PM.

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    My code requires the libpng and libtiff libraries. How should I handle this? Should I package these libraries with my own code and distribute it together? I assume a better approach would be to package my code separately and then tell any user they need to have the libtiff and libpng development libraries installed for their distro.
    I have seen some projects do both: offer a version of the library dependencies for download, but also link to the official websites for users to get possibly more updated versions.

    I'm also considering a CVS type thing for my code so others can contribute and help with my deficiencies. Any recommendations on how to do this. I have my own server but I'm also aware there are sites that can host this for me. I have no prior experience with CVS but willing to learn.
    I would, uh, recommend the Bazaar version control system. At the moment I primarily use Windows, but I found installing it on Ubuntu 7.10 to be pretty easy at my web server (but then you do not even need to install it on your own server, just that it would be slower to use). In terms of learning to use it I would say it is pretty easy too, with rather good documentation.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    I've also not distributed much code, so take with as many grains of salt as you can carry:

    I would also advise against including the libraries yourself, since that's just adding more complexity than you really want or need. (I know they're on debian's package manager system, since I have them; I don't know about other distros -- but if they're out there, save yourself the trouble.)

    For configure and make etc: How complicated a compilation is it, and is it likely to need a make install? If it's something that a department is going to install for everyone, then you might want to look into that; if you expect people are going to keep it in their home directories, then just setting up a normal makefile might be enough.

    I've never used a CVS server either, so I will defer (like I should have with the rest) to others.

  4. #4
    Registered User
    Join Date
    Dec 2007
    Posts
    9
    Thanks for the replies, I'll try out a CVS on my own server. I found that Kdevelop is good at creating the makefile for me. The dependencies are known within the project and so Kdevelop will know how to auto make the makefile. The documentation for Kdevelop actually recommends not manually creating the makefile so I'll trust that for now. Then its just a case of using tar to package everything together.

    The development libraries are very mature and available so I guess I'll just tell the user in the README or INSTALL text file that they must have these dependencies. I think ./configure will also tell them if something is necessary is missing.

  5. #5
    Registered User
    Join Date
    Sep 2004
    Location
    California
    Posts
    3,268
    Also most other packages have a configure script. What's the best way to create this so that the user can just do the normal ./configure, make, make install.
    These tools are called autoconf and automake. It takes a little while to learn how to use these, but once you have the hang of it, it will make it easy for other people to build and install your applications (even if they are on different platforms).

    There is a good tutorial on how to use these tools here. You probably don't need to read everything on that page, in fact you can probably jump to the first example and learn from there.

  6. #6
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    I'll try out a CVS on my own server.
    Incidentally, you really mean VCS (version control system), not CVS (Concurrent Versions System), which is a particular VCS.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  7. #7
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by bithub View Post
    These tools are called autoconf and automake. It takes a little while to learn how to use these, but once you have the hang of it, it will make it easy for other people to build and install your applications (even if they are on different platforms).

    There is a good tutorial on how to use these tools here. You probably don't need to read everything on that page, in fact you can probably jump to the first example and learn from there.
    But I would avoid that if you don't need to. If your dependencies on system components are fairly trivial, then you probably don't need the complex automake/autoconfig, but rather just a simple makefile.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Enforcing Machine Code Restrictions?
    By SMurf in forum Tech Board
    Replies: 21
    Last Post: 03-30-2009, 07:34 AM
  2. Values changing without reason?
    By subtled in forum C Programming
    Replies: 2
    Last Post: 04-19-2007, 10:20 AM
  3. Obfuscated Code Contest
    By Stack Overflow in forum Contests Board
    Replies: 51
    Last Post: 01-21-2005, 04:17 PM
  4. Interface Question
    By smog890 in forum C Programming
    Replies: 11
    Last Post: 06-03-2002, 05:06 PM
  5. Replies: 0
    Last Post: 02-21-2002, 06:05 PM