LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-17-2024, 07:09 AM   #1
Al99
LQ Newbie
 
Registered: Nov 2020
Posts: 22

Rep: Reputation: Disabled
How is the code in a tarball organised


Say I download the source for a package where do I look in there for the main function in the source code? How does the source code in a tarball differ from how it looks when it is installed on the system. I can't find any info on Google. Thanks
 
Old 02-17-2024, 08:26 AM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,876

Rep: Reputation: 7315Reputation: 7315Reputation: 7315Reputation: 7315Reputation: 7315Reputation: 7315Reputation: 7315Reputation: 7315Reputation: 7315Reputation: 7315Reputation: 7315
you need to unpack the tarball and you will get the original file/dir structure.
 
Old 02-17-2024, 08:33 AM   #3
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,587
Blog Entries: 19

Rep: Reputation: 4455Reputation: 4455Reputation: 4455Reputation: 4455Reputation: 4455Reputation: 4455Reputation: 4455Reputation: 4455Reputation: 4455Reputation: 4455Reputation: 4455
Every tarball wraps up a directory tree, so how it is organised depends on how the tree was organised. There are no rules for tarballs in general.

When it comes to tarballs for specific purposes, they are usually more uniform in their structure. A source code tree will typically be quite shallow and contain only a few subdirectories. There is often one called src for the actual source code, and there may be others for documentation files or an internal library. And there are some standard files that you expect to find in a top-level source directory. For example there will usually be a README file and there may be a separate INSTALL file.

If the package was built with autotools (the old-fashioned way of building source packages), there will be a configure script to run and some Makefiles. Packages built with more modern tools like meson will look different.

The INSTALL and README files will tell you what commands to run to compile and install the package, which makes it pretty easy even for a newbie. What you get at the end of the build is a lot of compiled binary files, and the final stage is to install these in their proper places. For a traditional autotools package, you would do this with "sudo make install". Note that you need root privileges (usually grabbed with sudo) to carry out this stage, but you don't need them for the actual compilation.

As to how it "looks", source code is highly-specialised text, whereas compiled files are binary code, so of course they will look quite different.
 
Old 02-17-2024, 08:37 AM   #4
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,719

Rep: Reputation: 5911Reputation: 5911Reputation: 5911Reputation: 5911Reputation: 5911Reputation: 5911Reputation: 5911Reputation: 5911Reputation: 5911Reputation: 5911Reputation: 5911
A tarball is basically directories and files combined into a single file as is regardless if it was compressed. What you see when extracted should be as it when the tarball was created.

A tar file does have a standard format on how everything is stored within.

I do not know exactly what you mean by main function except for maybe the c source file that contains
main( ).
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Which file in bash source code (tarball) contain a print output function Runicer Programming 2 03-20-2012 08:47 AM
Code tarball build failing in gnaupps (coreutils, grep) on a FC7 mad34 Linux - General 1 03-18-2010 05:49 AM
LINUX Driver Guys - GET ORGANISED or GET OUT Zabzoo Linux - Hardware 17 03-23-2007 09:52 PM
where is the .emacs file in the emacs source code tarball? aizkorri Programming 2 01-13-2007 02:05 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:27 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration