C Board  

Go Back   C Board > Platform Specific Boards > Linux Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 06-22-2007, 03:56 AM   #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
Marcux is offline   Reply With Quote
Old 06-22-2007, 06:14 AM   #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
divineleft is offline   Reply With Quote
Old 06-22-2007, 08:03 AM   #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!
Marcux is offline   Reply With Quote
Old 06-22-2007, 09:39 AM   #4
and the hat of Jobseeking
 
Salem's Avatar
 
Join Date: Aug 2001
Location: The edge of the known universe
Posts: 21,689
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.

Salem is offline   Reply With Quote
Old 06-22-2007, 11:29 AM   #5
Senior software engineer
 
brewbuck's Avatar
 
Join Date: Mar 2007
Location: Portland, OR
Posts: 5,768
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.
brewbuck is offline   Reply With Quote
Old 06-22-2007, 05:14 PM   #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!!
Marcux is offline   Reply With Quote
Old 06-22-2007, 05:57 PM   #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
divineleft is offline   Reply With Quote
Old 06-22-2007, 06:02 PM   #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
divineleft is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump

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


All times are GMT -6. The time now is 02:10 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22