Thread: How to make tarball (.tgz) for app?

  1. #1
    Registered User
    Join Date
    Nov 2006
    Posts
    9

    How to make tarball (.tgz) for app?

    Hi all!
    I am new to Linux programming and been googling for "how to" for making tarball packages for my apps.
    I haven't found what I am looking for and that is why my question ends up in this forum.
    Can someone point me at the right direction as I can not figure out how to make the tarball package in the right way. What I am looking for is when someone downloads my app they should be able to run: ./configure, make, make install on my tarball.

    The way I am compiling now is with gcc and language is C.

    Many thanks for all help!

    Marcux

  2. #2
    Registered User divineleft's Avatar
    Join Date
    Jul 2006
    Posts
    158
    run:
    Code:
    man tar
    in a terminal, and you will discover that it can be done with

    Code:
    tar -czf program-1.3.tgz program-1.3
    one cannot run `./configure`& `make` & so on without extracting it first.
    Gentoo Linux - 2.6.22.1
    GCC version 4.2.0

  3. #3
    Registered User
    Join Date
    Nov 2006
    Posts
    9
    Yes, ok, that is the way of making tarballs, but I realy want to get the whole chain and understanding of the "standard" linux way of packing programs.
    As I have understod it so far, I put my source files in my .tgz file and then I unpack it and after that the
    Code:
     ./configure
    produces the "makefile" and when using
    Code:
     make
    that command produces the compiled program and
    Code:
     make install
    installs the program in suitable folder, usualy: /usr/local/bin
    Right?
    But am I right that the configure script has to be written by me?
    Or is a "standard" script produced with
    Code:
     tar
    command, and in that case do I edit the configure file to install to another folder aso?
    Any good "How to" pages?

    Many thanks!

  4. #4
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    Various Linux based IDE's (such as k-develop) can generate the whole project, including a template configure script (IIRC). This you just edit like anything else to match your specific needs, but I imagine at the start the standard one will suffice.

    tar just creates one file out of many (like ZIP), it doesn't produce any more functionality.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  5. #5
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,396
    Quote Originally Posted by Marcux View Post
    But am I right that the configure script has to be written by me?
    Configure scripts are usually semi-automatically produced by a program called autoconf. Honestly, you don't want to go there. If your program doesn't use any platform-specific features, or is meant to only run in a certain kind of environment, there is NO NEED for a configure script. Just write a makefile. If people INSIST on a ./configure script, write a little script that does nothing but print out the word "Okay."

    Sometimes I download code where the configure script is 10 times longer than the source code of the program it is configuring. That's just STUPID.

    When the time comes that you actually need a configure script, you'll know it. Don't make one just because everybody else does.

  6. #6
    Registered User
    Join Date
    Nov 2006
    Posts
    9
    Hi brewbuck!
    Please breaf me in!
    So I do not need the configure script?
    It is generated by autoconfig, how does it work, what does autoconfig generate?
    I am about to finish a terminal program with no dependencies of other apps.
    The way I have understood it I need a confígure script when I have dependencies of other apps, like for instance if I need a SQL-server I specify it in a configure script, am I right?
    How do I write my makefile file? What is needed in it? Please point me in the right direction!

    Many, many thanks for all the help!!

  7. #7
    Registered User divineleft's Avatar
    Join Date
    Jul 2006
    Posts
    158
    Quote Originally Posted by brewbuck View Post
    Configure scripts are usually semi-automatically produced by a program called autoconf. Honestly, you don't want to go there. If your program doesn't use any platform-specific features, or is meant to only run in a certain kind of environment, there is NO NEED for a configure script. Just write a makefile. If people INSIST on a ./configure script, write a little script that does nothing but print out the word "Okay."

    Sometimes I download code where the configure script is 10 times longer than the source code of the program it is configuring. That's just STUPID.

    When the time comes that you actually need a configure script, you'll know it. Don't make one just because everybody else does.
    It's not necessarily stupid, because people place files in different directories in the gnu system. Granted the program is stupid, but the idea isn't. I've read that scons is a really nice alternative.
    Gentoo Linux - 2.6.22.1
    GCC version 4.2.0

  8. #8
    Registered User divineleft's Avatar
    Join Date
    Jul 2006
    Posts
    158
    Quote Originally Posted by Marcux View Post
    Hi brewbuck!
    Please breaf me in!
    So I do not need the configure script?
    It is generated by autoconfig, how does it work, what does autoconfig generate?
    I am about to finish a terminal program with no dependencies of other apps.
    The way I have understood it I need a confígure script when I have dependencies of other apps, like for instance if I need a SQL-server I specify it in a configure script, am I right?
    How do I write my makefile file? What is needed in it? Please point me in the right direction!

    Many, many thanks for all the help!!
    the configure executable is just for the makefiles to know where the libraries are located, if certain libraries are even installed, where to install the program, what features to include / exclude, etc... You don't need it, but if you're looking to distribute your code to others, you might want to look into a program that automatically configures the makefiles and stuff.

    as for makefiles, they are pretty much standard gnu stuff. you can look into them here. all they do is automate the compiling process, including linking, removing old object files, installing files, etc..

    You technically don't need either makefiles or autoconfigurations, but there's nothing bad about `make` that i can think of and it makes your life as a developer a hell of a lot easier. autoconf on the other hand... well, only use it if you have to.
    Gentoo Linux - 2.6.22.1
    GCC version 4.2.0

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Makefile Problem: None rule to make target
    By chris24300 in forum Linux Programming
    Replies: 25
    Last Post: 06-17-2009, 09:45 AM
  2. Establishing 'make clean' with GNU make
    By Jesdisciple in forum C Programming
    Replies: 9
    Last Post: 04-11-2009, 09:10 AM
  3. How to make a Packet sniffer/filter?
    By shown in forum C++ Programming
    Replies: 2
    Last Post: 02-22-2009, 09:51 PM
  4. HELP!wanting to make full screen game windowed
    By rented in forum Game Programming
    Replies: 3
    Last Post: 06-11-2004, 04:19 AM
  5. make all rule
    By duffy in forum C Programming
    Replies: 9
    Last Post: 09-11-2003, 01:05 PM