LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 10-13-2020, 05:13 PM   #1
FlinchX
Member
 
Registered: Nov 2017
Distribution: Slackware Linux
Posts: 666

Rep: Reputation: Disabled
What is the recommended way to build a Slackware package for software that does not provide a source code tarball?


I looked at the reference SBo templates at https://slackbuilds.org/templates/ and they seem to assume that there's a source code tarball for the package that is being built.

That is not always the case. Sometimes there's just a source code repository without tags/releases.

What is the recommended way to write the SlackBuild for those? I'd like to learn the conventions that buildscript writers follow because I can imagine at least two different ways of doing it:

1. Clone the repository and work with it directly

2. Have the SlackBuild produce a snapshot source code tarball (for git, it would be `git archive`, but other version control systems have similar functionality), then process that tarball the same way like a regular source code tarball.
 
Old 10-13-2020, 05:55 PM   #2
Tonus
Senior Member
 
Registered: Jan 2007
Location: Paris, France
Distribution: Slackware-15.0
Posts: 1,405
Blog Entries: 3

Rep: Reputation: 514Reputation: 514Reputation: 514Reputation: 514Reputation: 514Reputation: 514
There could be a download related to a commit or sources hosted elsewhere.
I don't recall a slackbuild I use with a git command but might have wrong memories…
 
Old 10-13-2020, 06:14 PM   #3
upnort
Senior Member
 
Registered: Oct 2014
Distribution: Slackware
Posts: 1,893

Rep: Reputation: 1161Reputation: 1161Reputation: 1161Reputation: 1161Reputation: 1161Reputation: 1161Reputation: 1161Reputation: 1161Reputation: 1161
Try something like this:

Code:
# Fetch the source if not already present
if [ ! -d "$TMP/${PRGNAM}_$VERSION" ]; then
  mkdir -p "$TMP/${PRGNAM}_$VERSION"
  git clone git://online_git_location.com/some_program_name/some_program_name.git "$TMP/${PRGNAM}_$VERSION"
fi
 
Old 10-13-2020, 06:19 PM   #4
bassmadrigal
LQ Guru
 
Registered: Nov 2003
Location: West Jordan, UT, USA
Distribution: Slackware
Posts: 8,792

Rep: Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656
SBo doesn't allow cloning git repos in the SlackBuild. The sources need to be linked in the .info files and have to point to a specific downloadable file. If you decide to host your own SlackBuilds, you can clone repos within the SlackBuild. I know Pat does this for a few packages (like kernel-firmware) and Eric might have a few on his, but they just aren't allowed on SBo like that.

If you're planning on submitting to SBo, most source repositories have a way to grab a tarball from a specific commit (assuming they don't have releases available or the releases are too old). I know github offers this and I've used it several times.

You can see a good example with my freegish SlackBuild (I just realized this not on SBo... I'm not sure if I forgot to submit it or it was on there and is now removed or maybe it is broken and I hadn't fixed it and then forgot -- I'll have to look into this). This is a pretty straightforward SlackBuild and should be easy to tailor to other programs (the only unique things are the patch and copying assets over).

Typically the URL from github would look something like this:

Code:
https://github.com/$owner/$project/archive/$7character-commit/$project-$full-commit-ID.tar.gz
freegish's download link looks like this:

Code:
https://github.com/freegish/freegish/archive/8795cd7/freegish-8795cd7adc95957883f2d3465eb9036a774667a7.tar.gz
The 7 character commit ID, or short commit ID, is the first 7 characters of the full commit ID (8795cd7adc95957883f2d3465eb9036a774667a7).

You will use the short commit ID for the VERSION as well (although, technically, you could use the full commit ID, but that's just seems too long for a version number).

In the SlackBuild, you'll want to use VERSION and SRCVER variables. The VERSION will be the short commit ID, while the SRCVER would be the full commit ID. This is because you want a shorter version number, but the github source tarball will extract everything into a $project-$full-commit-ID/ folder (which is why we name the download the same for an easier time in the SlackBuild).
 
2 members found this post helpful.
Old 10-13-2020, 06:23 PM   #5
FlinchX
Member
 
Registered: Nov 2017
Distribution: Slackware Linux
Posts: 666

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by bassmadrigal View Post
If you're planning on submitting to SBo
Just to avoid any confusion, no, I'm not planning to submit to SBo. Just trying to learn what are the best practices for such less common situations.
 
Old 10-13-2020, 06:47 PM   #6
bassmadrigal
LQ Guru
 
Registered: Nov 2003
Location: West Jordan, UT, USA
Distribution: Slackware
Posts: 8,792

Rep: Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656
Quote:
Originally Posted by FlinchX View Post
Just to avoid any confusion, no, I'm not planning to submit to SBo. Just trying to learn what are the best practices for such less common situations.
You can then look at the kernel-firmware SlackBuild to see how Pat uses a repo to package the latest version.

Just be warned that if you are doing this with a compilable piece of software, cloning the repo and using the latest update could lead to your SlackBuild breaking if they move things around or change build systems (as a lot of people are moving from autotools to cmake or meson, which requires a reworking of the SlackBuild).

Even if you're not submitting it to SBo, I'd still recommend using a specific commit and then update to newer commits whenever you get the itch to test the newer version.
 
  


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
[SOLVED] No package 'x11' found No package 'xext' found No package 'xdamage' found No package 'xfixes' found No package 'x11-xcb' found Jigsaw Linux From Scratch 14 02-23-2021 08:35 PM
does ubuntu provide its filesystem source code? david_8274 Linux - Newbie 2 05-09-2014 09:00 PM
Yum: What "Package Group" can provide a package? stefanlasiewski Red Hat 7 03-21-2013 01:31 PM
Code tarball build failing in gnaupps (coreutils, grep) on a FC7 mad34 Linux - General 1 03-18-2010 05:49 AM
Recommended way to install from source code and yet manageable by package system? Akhran Debian 6 03-12-2006 10:03 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 03:10 AM.

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