Slackware This Forum is for the discussion of Slackware Linux.
|
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
03-07-2014, 08:14 AM
|
#1
|
Senior Member
Registered: Nov 2013
Location: Brazil
Distribution: Slackware
Posts: 1,223
Rep: 
|
Need help writing a SlackBuild
Hi, recently I got interested about cryptocurrency and decided to give DogeCoin a try. I went to their website and it says that Linux users have to compile it by source, what is no problem. Instead of just compiling it, I decided to try to write my first SlackBuild. It didn't work and I already deleted it (it would never work the way I was trying, anyways).
There are two ways to compile it:
For the QT-version (dogecoin-qt):
Code:
git clone https://github.com/dogecoin/dogecoin
cd dogecoin
qmake
make
For the cli-version (dogecoind)
Code:
git clone https://github.com/dogecoin/dogecoin
cd dogecoin/src
make -f makefile.unix USE_UPNP=1 USE_IPV6=1 USE_QRCODE=1
Both methods will compile the binaries and store them at "dogecoin" or "dogecoin/src" directories.
I tried using this guide but I am not seeing a way to use it for this package. How do I gather the package version, for example? How do I make a package off it?
Thanks.
EDIT: I just noticed the makefile has a "DESTDIR" variable, will work with that. But still need to know how to gather the package version off the git directory.
EDIT2: It works 
If you are interested about it, grab it here
EDIT3: The slackbuild above is bad, grab this one instead, slack-desc file
Last edited by moisespedro; 03-07-2014 at 02:05 PM.
|
|
|
03-07-2014, 08:41 AM
|
#2
|
Senior Member
Registered: Nov 2013
Location: Brazil
Distribution: Slackware
Posts: 1,223
Original Poster
Rep: 
|
Here it is how it looks like currently (I am running it as I create this post)
Code:
#!/bin/sh -e
CWD=$(pwd)
if [ "$TMP" = "" ]; then
TMP=/tmp
fi
VERSION=git
PKG_VERSION=git
BUILD=${BUILD:-1_pmg}
APP=dogecoin-qt
PKG=$TMP/package-$APP
MARCH=$( uname -m )
if [ -z "$ARCH" ]; then
case "$MARCH" in
i?86) export ARCH=i686 ;;
x86_64) export ARCH=x86_64 ;;
esac
fi
if [ "$ARCH" = "i686" ]; then
SLKCFLAGS="-O2 -march=i486 -mtune=i686"
LIBDIRSUFFIX=""
elif [ "$ARCH" = "x86_64" ]; then
SLKCFLAGS="-O2 -fPIC"
LIBDIRSUFFIX="64"
fi
rm -rf $PKG
mkdir -p $TMP $PKG
rm -rf $TMP/$APP-$VERSION
cd $TMP || exit 1
git clone https://github.com/dogecoin/dogecoin
cd dogecoin
chown -R root:root .
chmod -R u+w,go+r-w,a-s .
qmake || exit
make || exit
make install DESTDIR=$PKG || exit
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
cd $PKG
/sbin/makepkg -l y -c n $TMP/$APP-$PKG_VERSION-$ARCH-$BUILD.tgz
|
|
|
03-07-2014, 08:46 AM
|
#3
|
Member
Registered: Jan 2014
Distribution: Slackware 14.1 (MLED 32-bit)
Posts: 84
Rep: 
|
I have recently found Alien's SlackBuild Toolkit quite helpful for creating a SlackBuild template that can be further tweaked as you like.
About the package version: when you go to https://github.com/dogecoin/dogecoin, you can see a tab saying "9 releases"; there you can get the latest one (1.5.2) and use it (instead cloning the development repo) as an input for AST (the link above).
HTH
|
|
|
03-07-2014, 08:49 AM
|
#4
|
Senior Member
Registered: Nov 2013
Location: Brazil
Distribution: Slackware
Posts: 1,223
Original Poster
Rep: 
|
Ok, I didn't see that. The development version is 1.5.3. Anyways, my script didn't work.
Code:
Creating Slackware package: /tmp/dogecoin-qt-git-x86_64-1_pmg.tgz
./
install/
install/slack-desc
WARNING: zero length file install/slack-desc
Slackware package /tmp/dogecoin-qt-git-x86_64-1_pmg.tgz created.
EDIT: And I forgot: thanks for the tip
Last edited by moisespedro; 03-07-2014 at 08:52 AM.
|
|
|
03-07-2014, 08:59 AM
|
#5
|
Senior Member
Registered: Sep 2009
Location: Yorks. W.R. 167397
Distribution: Slackware
Posts: 1,307
Rep: 
|
Quote:
Originally Posted by moisespedro
still need to know how to gather the package version off the git directory.
|
Much versions. So problem. Plz money. Wow
Don't use git clone. Use one of the tagged releases from the link that says '9 releases', the releases page. To get the latest release, 1.5.2, use the URL at the grey button marked 'Source code (tar.gz)'. Either click the button and save the file, or use this command: wget --content-disposition "https://github.com/dogecoin/dogecoin/archive/1.5.2.tar.gz"
This should get you the archive file you need, dogecoin-1.5.2.tar.gz, with its version number obviously 1.5.2. It is important to use a proper tagged release wherever possible, because it will give you a repeatable build. In most projects there is no guarantee that the latest git will even compile correctly.
Because their project doesn't use autotools or cmake, but just qmake and make, you are going to have to do your best by reading the Makefile to find out how to control it. If it's really difficult, do not allow the Makefile to install the files, instead you can write the SlackBuild so it copies the files to the right locations after they have been built.
Edit: Beaten to it... gotta work those browser tabs quicker 
Last edited by 55020; 03-07-2014 at 09:06 AM.
Reason: much answer. so cool.
|
|
|
03-07-2014, 09:04 AM
|
#6
|
Senior Member
Registered: Nov 2013
Location: Brazil
Distribution: Slackware
Posts: 1,223
Original Poster
Rep: 
|
I think copying the files would be the best solution. I tried "make install DESTDIR=$PKG || exit" now I am trying "make DESTDIR=$PKG || exit". Does that even work? I mean "make DESTDIR"? Anyways, here is how it looks like. Much build wow.
EDIT: Yeah, it doesn't work. Will make a doinst.sh file to copy the binary to the correct place, it is easier.
Last edited by moisespedro; 03-07-2014 at 09:05 AM.
|
|
|
03-07-2014, 10:15 AM
|
#7
|
Senior Member
Registered: Nov 2013
Location: Brazil
Distribution: Slackware
Posts: 1,223
Original Poster
Rep: 
|
Made one, it works now. It doesn't have a slack-desc yet but it works. Anyone interested on it can grab it here. I plan on making it better later, with slack-desc and a .desktop file (to integrate it with XFCE menu). Currently, you have to launch it via terminal using "/usr/bin/dogecoin-qt". Thanks for everyone who helped me 
|
|
|
03-07-2014, 10:41 AM
|
#8
|
Member
Registered: Jul 2008
Distribution: Slackware 13.1
Posts: 305
Rep:
|
Quote:
Originally Posted by moisespedro
Ok, I didn't see that. The development version is 1.5.3. Anyways, my script didn't work.
Code:
Creating Slackware package: /tmp/dogecoin-qt-git-x86_64-1_pmg.tgz
./
install/
install/slack-desc
WARNING: zero length file install/slack-desc
Slackware package /tmp/dogecoin-qt-git-x86_64-1_pmg.tgz created.
EDIT: And I forgot: thanks for the tip
|
The problem with your slackbuild is that when you compile with qmake then it creates a Makefile. In the Makefile it doesn't use "DESTDIR", but instead uses "INSTALL_ROOT". So when there was no output from makepkg for anything other than ./install/slack-desc, it means that the files were installed to the rootfs rather then the temporary sysroot (Eg. /tmp/package-dogecoin-qt).
Also, your final slackbuild here doesn't even have a make install step. So you are using a previously compiled binary that is already installed on your system.
|
|
|
03-07-2014, 11:29 AM
|
#9
|
Senior Member
Registered: Nov 2013
Location: Brazil
Distribution: Slackware
Posts: 1,223
Original Poster
Rep: 
|
Quote:
Originally Posted by larryhaja
The problem with your slackbuild is that when you compile with qmake then it creates a Makefile. In the Makefile it doesn't use "DESTDIR", but instead uses "INSTALL_ROOT". So when there was no output from makepkg for anything other than ./install/slack-desc, it means that the files were installed to the rootfs rather then the temporary sysroot (Eg. /tmp/package-dogecoin-qt).
Also, your final slackbuild here doesn't even have a make install step. So you are using a previously compiled binary that is already installed on your system.
|
The binary file is compiled by the slackbuild and the postinstall script copies it to /usr/bin
|
|
|
03-07-2014, 11:43 AM
|
#10
|
Member
Registered: Jul 2008
Distribution: Slackware 13.1
Posts: 305
Rep:
|
Quote:
Originally Posted by moisespedro
The binary file is compiled by the slackbuild and the postinstall script copies it to /usr/bin
|
You're right. I missed the 'cp ${PRGNAM}-${TK} /usr/bin/${PRGNAM}-${TK}' line. But it still installs to the rootfs rather than the sysroot.
|
|
|
03-07-2014, 11:48 AM
|
#11
|
Member
Registered: Sep 2009
Location: Germany
Distribution: slackware64-current
Posts: 89
Rep:
|
Quote:
Originally Posted by moisespedro
The binary file is compiled by the slackbuild and the postinstall script copies it to /usr/bin
|
It should probably copy to $PKG/usr/bin so it ends up in the package you build.
You can look at the bitcoin.SlackBuild for some inspiration, it works almost the same like dogecoin.
http://slackbuilds.org/repository/14.1/network/bitcoin/ 
|
|
|
03-07-2014, 11:59 AM
|
#12
|
Senior Member
Registered: Nov 2013
Location: Brazil
Distribution: Slackware
Posts: 1,223
Original Poster
Rep: 
|
Quote:
Originally Posted by hotchili
|
Gonna take a look at it, and the slackbuild worked fine. Too bad I accidentally removed it 
|
|
|
03-07-2014, 12:52 PM
|
#13
|
Senior Member
Registered: Nov 2013
Location: Brazil
Distribution: Slackware
Posts: 1,223
Original Poster
Rep: 
|
Last post here: thanks for all the help guys, I learnt a lot and it was fun 
It works and I've posted a good SlackBuild at the original post, thank you all.
|
|
|
All times are GMT -5. The time now is 01:00 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|