LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 03-07-2014, 08:14 AM   #1
moisespedro
Senior Member
 
Registered: Nov 2013
Location: Brazil
Distribution: Slackware
Posts: 1,223

Rep: Reputation: 195Reputation: 195
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.
 
Old 03-07-2014, 08:41 AM   #2
moisespedro
Senior Member
 
Registered: Nov 2013
Location: Brazil
Distribution: Slackware
Posts: 1,223

Original Poster
Rep: Reputation: 195Reputation: 195
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
 
Old 03-07-2014, 08:46 AM   #3
s09
Member
 
Registered: Jan 2014
Distribution: Slackware 14.1 (MLED 32-bit)
Posts: 84

Rep: Reputation: Disabled
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
 
Old 03-07-2014, 08:49 AM   #4
moisespedro
Senior Member
 
Registered: Nov 2013
Location: Brazil
Distribution: Slackware
Posts: 1,223

Original Poster
Rep: Reputation: 195Reputation: 195
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.
 
Old 03-07-2014, 08:59 AM   #5
55020
Senior Member
 
Registered: Sep 2009
Location: Yorks. W.R. 167397
Distribution: Slackware
Posts: 1,307
Blog Entries: 4

Rep: Reputation: Disabled
Quote:
Originally Posted by moisespedro View Post
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.
 
Old 03-07-2014, 09:04 AM   #6
moisespedro
Senior Member
 
Registered: Nov 2013
Location: Brazil
Distribution: Slackware
Posts: 1,223

Original Poster
Rep: Reputation: 195Reputation: 195
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.
 
Old 03-07-2014, 10:15 AM   #7
moisespedro
Senior Member
 
Registered: Nov 2013
Location: Brazil
Distribution: Slackware
Posts: 1,223

Original Poster
Rep: Reputation: 195Reputation: 195
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
 
Old 03-07-2014, 10:41 AM   #8
larryhaja
Member
 
Registered: Jul 2008
Distribution: Slackware 13.1
Posts: 305

Rep: Reputation: 80
Quote:
Originally Posted by moisespedro View Post
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.
 
Old 03-07-2014, 11:29 AM   #9
moisespedro
Senior Member
 
Registered: Nov 2013
Location: Brazil
Distribution: Slackware
Posts: 1,223

Original Poster
Rep: Reputation: 195Reputation: 195
Quote:
Originally Posted by larryhaja View Post
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
 
Old 03-07-2014, 11:43 AM   #10
larryhaja
Member
 
Registered: Jul 2008
Distribution: Slackware 13.1
Posts: 305

Rep: Reputation: 80
Quote:
Originally Posted by moisespedro View Post
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.
 
Old 03-07-2014, 11:48 AM   #11
hotchili
Member
 
Registered: Sep 2009
Location: Germany
Distribution: slackware64-current
Posts: 89

Rep: Reputation: 32
Quote:
Originally Posted by moisespedro View Post
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/
 
Old 03-07-2014, 11:59 AM   #12
moisespedro
Senior Member
 
Registered: Nov 2013
Location: Brazil
Distribution: Slackware
Posts: 1,223

Original Poster
Rep: Reputation: 195Reputation: 195
Quote:
Originally Posted by hotchili View Post
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/
Gonna take a look at it, and the slackbuild worked fine. Too bad I accidentally removed it
 
Old 03-07-2014, 12:52 PM   #13
moisespedro
Senior Member
 
Registered: Nov 2013
Location: Brazil
Distribution: Slackware
Posts: 1,223

Original Poster
Rep: Reputation: 195Reputation: 195
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Writing Apps & Helpers for writers (all kinds) tech-writing, fiction, etc?? linus72 Debian 9 09-28-2009 09:34 AM
Writing my first Slackbuild and cannot add an entry to KDE games menu samac Slackware 11 02-04-2009 05:04 PM
Writing to tty causes writing to disk? (in ancient 2.2.x kernel) borsburn Linux - Kernel 0 12-17-2008 12:47 PM
Help writing a SlackBuild script khronosschoty Slackware 10 10-25-2008 11:19 AM
LXer: Democratization, Writing and Writing Code LXer Syndicated Linux News 0 11-22-2006 05:03 AM

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

All times are GMT -5. The time now is 01:00 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