To make a slackware package, this is the general process i use.
This writeup assumes the source uses autoconf/automake (has a normal configure-script and a Makefile generated by automake).
Before making the package, make sure to check it doesn't already exist in slackware-current.
If there is a package in slackware-current, but it is the wrong version, then just take the SlackBuild-script used for building that package from the source-directory and change it. Often you just have to change a VERSION-variable at the top of the script.
If you're still making the package manually, then read on.
First run configure using the parameters you want to use, and with the prefix you want to use.
Default prefix if you don't supply one is /usr/local, which is why software is installed there by default. You probably want /usr.
Build just as always:
This is where it gets neat. Instead of installing the software onto the system we want to put it in a directory where we can package it.
Makefiles made by recent versions of automake support a variable called DESTDIR, which controls where make install puts the files. If the project uses an older version of automake, you'll have to supply another prefix instead.
I run this as root, to make sure that files get the same permissions as they would if they were installed normally.
grep -r DESTDIR *
The -r is there to also search subdirectories, since some Makefiles somtimes include the automake-part from a Makefile in a subdirectory.
If this returns anything in any file that looks like a Makefile, DESTDIR is most likely supported.
make DESTDIR=/tmp/slackpack/example-0.1-beta install
No worries, just put the wanted DESTDIR in front of the prefix, and install like so:
make prefix=/tmp/slackpack/example-0.1-beta/usr install
When i feel that the Makefile seems to be somewhat buggy and unfeatureful, i use the -n option of make to simulate an install, just to see what would happen.
Go to the destination directory:
I look through the directories created to check if all files seem to be there, and that everything looks OK.
I go into the bin, lib, and sbin directories and run strip *. This often reduces the size of the package considerably. Sometimes you can use the make-target install-strip to do this.
I then usually copy documentation files, like AUTHORS, LICENSE, README, ChangeLog, and any other documentation, from the source-directory into the documentation directory of the destination which i also create:
mkdir -p /tmp/slackpack/example-0.1-beta/usr/doc/example-0.1beta cd /tmp/source/example-0.1-beta cp -R docs/ AUTHORS ChangeLog COPYING INSTALL README NEWS /tmp/slackpack/example-0.1-beta/usr/doc/example-0.1beta
The name of the documentation directory should match the "name-version" of the package name, see note below.
I also chown the files, since the files copied aren't owned by root.
chown -R root:root /tmp/slackpack/example-0.1-beta/usr/doc/example-0.1beta
I then go over the package one last time, making sure everything is OK, and then i make the package.
A slackware package name consists of four parts, separated by hyphens.
Of these, only the name can contain hyphens. Sometimes you want a hyphen in the version number. Just use an underscore or (better) squash it together. For example, 0.1-beta becomes 0.1beta.
Note that the name of the documentation directory should match the "name-version" of the package name, so if you squash the version in the package name, do so in the name of the documentation directory too.
To make a package you use makepkg(8):
cd /tmp/slackpack/example-0.1-beta makepkg example-0.1beta-i386-1.tgz
makepkg(8) will ask you if you want to create an installation script and add all symbolic links to it, and if you want to change ownership and permissions of all directories to root:root and 0755. Just answer yes to both question, unless there is anything specific in this package that calls for special treatment.