View Full Version : Building libdvdcss

6th June 2015, 09:12 PM
Since i've came along a reference link to http://forums.fedoraforum.org/showthread.php?t=304745, i thought i'd improve that with this little bash code here.

As i am a coder, i have these tools installed already anyway, but you might need them:
As root:

dnf install make autoconf automake gcc

(using php tags only for syntax highlighting):

#!/usr/bin/env bash
# Author: sea
# Date: 2015.06.06
# Changed: 2015.06.06
# Description: Installs (libs) or updates the package from source
# Variables
# General
# Change 'DIR_SRC' if you want to save the sources elsewhere
# Use a dot ".", to keep using the current directory
# Project specific
# Action and Display
if [ -z "$(echo $ACTION)" ]
then printf '%s\n' \
"$ME ($script_version)" \
"Usage: $ME ACTION" \
"Where ACTION is one of the following:" \
" * install" \
" * update" \
" * libsonly" \
exit 1

# This has to be done anyway
[ -d "$DIR_SRC" ] || mkdir -p "$DIR_SRC"
cd "$DIR_SRC"
git clone "$URL"
cd "$PKG"

# The actual task
autoreconf -i || exit 1
./configure --prefix="$DIR_PREFIX" || exit 1

# Make it and decide if successfull
make && \
if [ "${ACTION/update/install}" = install ]
then if [ 0 -ne $UID ]
then # Hi $USER
echo "How to $ACTION $PKG?"
select job in su sudo;do
case $job in
sudo) sudo make install ;;
su) su -c "make install" ;;
else # Its a root already
make install

Outputs as ('...' indicate cut-outs):

$ time libdvdcss.sh install
Cloning into 'libdvdcss'...
remote: Counting objects: 2634, done.
remote: Compressing objects: 100% (1329/1329), done.
remote: Total 2634 (delta 1878), reused 1772 (delta 1265)
Receiving objects: 100% (2634/2634), 738.62 KiB | 559.00 KiB/s, done.
Resolving deltas: 100% (1878/1878), done.
Checking connectivity... done.
libtoolize: putting auxiliary files in `.'.
libtoolize: copying file `./ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `m4'.
libtoolize: copying file `m4/libtool.m4'
checking for an ANSI C-conforming const... yes
checking for inline... inline
checking for size_t... yes
checking for unistd.h... (cached) yes
checking sys/param.h usability... yes
checking sys/param.h presence... yes
checking for sys/param.h... yes
checking sys/uio.h usability... yes
checking sys/uio.h presence... yes
CC src/libdvdcss.lo
CC src/device.lo
CC src/css.lo
CC src/ioctl.lo
CC src/error.lo
CCLD libdvdcss.la
make[1]: Leaving directory '/home/sea/data/build_sources/libdvdcss'
How to install libdvdcss?
1) su
2) sudo
#? 2
make[1]: Entering directory '/home/sea/data/build_sources/libdvdcss'
/bin/mkdir -p '/usr/lib64'
/bin/sh ./libtool --mode=install /bin/install -c libdvdcss.la '/usr/lib64'
libtool: install: /bin/install -c .libs/libdvdcss.so.2.2.0 /usr/lib64/libdvdcss.so.2.2.0
libtool: install: (cd /usr/lib64 && { ln -s -f libdvdcss.so.2.2.0 libdvdcss.so.2 || { rm -f libdvdcss.so.2 && ln -s libdvdcss.so.2.2.0 libdvdcss.so.2; }; })
libtool: install: (cd /usr/lib64 && { ln -s -f libdvdcss.so.2.2.0 libdvdcss.so || { rm -f libdvdcss.so && ln -s libdvdcss.so.2.2.0 libdvdcss.so; }; })
libtool: install: /bin/install -c .libs/libdvdcss.lai /usr/lib64/libdvdcss.la
libtool: install: /bin/install -c .libs/libdvdcss.a /usr/lib64/libdvdcss.a
libtool: install: chmod 644 /usr/lib64/libdvdcss.a
libtool: install: ranlib /usr/lib64/libdvdcss.a
libtool: finish: PATH="/sbin:/bin:/usr/sbin:/usr/bin:/sbin" ldconfig -n /usr/lib64
Libraries have been installed in:

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
- add LIBDIR to the `LD_LIBRARY_PATH' environment variable
during execution
- add LIBDIR to the `LD_RUN_PATH' environment variable
during linking
- use the `-Wl,-rpath -Wl,LIBDIR' linker flag
- have your system administrator add LIBDIR to `/etc/ld.so.conf'

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
/bin/mkdir -p '/usr/share/doc/libdvdcss'
/bin/install -c -m 644 AUTHORS COPYING NEWS README ChangeLog '/usr/share/doc/libdvdcss'
/bin/mkdir -p '/usr/lib64/pkgconfig'
/bin/install -c -m 644 src/libdvdcss.pc '/usr/lib64/pkgconfig'
/bin/mkdir -p '/usr/include/dvdcss'
/bin/install -c -m 644 src/dvdcss/dvdcss.h '/usr/include/dvdcss'
make[1]: Leaving directory '/home/sea/data/build_sources/libdvdcss'

Its quite fast:

real 0m12.273s
user 0m5.854s
sys 0m2.253s

Hope this helps, have fun :)

Once you have this script with execution flag in $HOME/bin or $HOME/.local/bin, you will never have to run for a repo just for this package again.
Just backup the script along with your data and re run it after the next installation.