libcpuid 0.2.1 SlackBuild and packages

In the last week I’ve tried to make my first SlackBuild script. I’ve decided to start with libcpuid.

libcpuid is a small C library for x86 CPU detection and feature extraction.
Using it, you can:

  • get the processor vendor, model, brand string, code name
  • get information about CPU features such as: number of cores or logical CPUs, cache sizes, CPU clock
  • check if the processor implements a specific instruction set such as the SSE2, 3DNow!
  • execute the CPUID and RDTSC instructions (portably!)
  • and have this all in your commercial application, without getting into trouble.

It works on Windows, Linux and Mac OS X, both 32-bit and 64-bit flavours. Compiler support
includes GCC and Microsoft Visual C++ (and compatible, e.g. Intel C++ compiler).

I’ve submitted a .tar.gz to the admin staff of SlackBuilds.org and, after a few days, they have approved it. You can find there all the needed to build your package.

On this site I also provide a modified version of the SlackBuild and the prebuilt packages for x86 and x86_64 architectures. You can find all these files into my “Slackware stuff” section (see on the right).

Just a brief reminder on how to build the package using the SlackBuild script:

Download the .tar.gz containing the SlackBuild script (libcpuid.tar.gz) and the sources (libcpuid-0.2.1.tar.gz in this case).

After having placed the two files in the same directory, open a terminal and place yourself into that directory using the cd command.

Unpack the SlackBuild archive, place the sources into the unpacked folder and enter into that folder:

tar -zxvf libcpuid.tar.gz
mv libcpuid-0.2.1.tar.gz libcpuid
cd libcpuid

Now, give the execution permissions to the script:

chmod +x libcpuid.SlackBuild

Become super user (you must insert the root password) and then launch the script:

su
./libcpuid.SlackBuild

At the end of the building procedure you will find your package into the /tmp directory.
Now, to install the package give this command:

installpkg /tmp/libcpuid-*.t?z

This command covers all the possible cases, also depending on which SlackBuild script you use. In particular it takes in account of:

  • target architecture
  • package tag (if any)
  • package version
  • package format (can be .tgz or .txz)

Ok, if all succeeded, libcpuid is now installed on your system!

Did you like this post? Share it! Email this to someoneShare on Google+Tweet about this on TwitterShare on FacebookShare on LinkedIn

Leave a Reply