Unverified Commit d264596e authored by porres's avatar porres Committed by GitHub
Browse files

Merge pull request #5 from reduzent/linuxdep

Linuxdep
parents 751a3901 722b8411
......@@ -70,9 +70,9 @@ and install the **ntldd** package:
`pacman -S mingw32/mingw-w64-i686-ntldd-git`
`pacman -S mingw64/mingw-w64-x86_64-ntldd-git`
`pacman -S mingw64/mingw-w64-x86_64-ntldd-git`
Then `cd` MinGW to this repo and do:
Then `cd` MinGW to this repo and do:
`make`
......@@ -90,31 +90,27 @@ then do this command that fills dependencies on the installation dir:
first build **fluidsynth**! Download sources from https://github.com/FluidSynth/fluidsynth/releases and get the following dependencies (shown for Debian)
`sudo apt install cmake libglib2.0-dev pkgconf`
`sudo apt install cmake libglib2.0-dev libsndfile1-dev patchelf`
(patchelf is not needed for building fluidsynth, but for a later step)
then `cd` to your fluidsynth sources dir an do:
`````
mkdir build
cd build
cmake ..
cmake -Denable-libsndfile=on -Denable-jack=off -Denable-alsa=off -Denable-oss=off -Denable-pulseaudio=off -Denable-ladspa=off -Denable-aufile=off -Denable-network=off -Denable-ipv6=off -Denable-getopt=off -Denable-sdl2=off -Denable-threads=off ..
sudo make install
`````
then `cd` to the sources of this repo and do
then `cd` to the sources of this repo and do (change the pgklibdir path according to your needs):
`make install`
`make pkglibdir=$HOME/Pd/externals install`
after that run the linuxdepXX.sh script that matches the architecture of your build. This script copies fluidsynth dependencies to your fluid~ external folder. Example for 64bit:
Now you can copy all dependencies of `fluidsynth~.pd_linux` to the install path by running:
`````
cd <to/your/fluid~/installation/dir>
chmod 775 linuxdep64.sh
./linuxdep64.sh
`````
Now the fluidsynth dependencies are copied to your fluid~ external folder.
`make pkglibdir=$HOME/Pd/externals localdep_linux`
The result can be uploaded to Deken, since it runs also on systems where the fluidsynth library is not installed.
--------------------------------------------------------------------------
......
......@@ -12,11 +12,7 @@ endef
define forLinux
ifeq ($(firstword $(subst -, ,$(shell $(CC) -dumpmachine))), i686)
datafiles += scripts/linuxdep32.sh
else
datafiles += scripts/linuxdep64.sh
endif
datafiles += scripts/localdeps.linux.sh
endef
......@@ -26,11 +22,14 @@ define forDarwin
endef
datafiles = fluidsynth~-help.pd LICENSE.txt README.md
datafiles = fluidsynth~-help.pd LICENSE.txt README.md
datadirs = sf2
include pd-lib-builder/Makefile.pdlibbuilder
windep: install
cd "${installpath}"; ./windep.sh fluidsynth~.dll
\ No newline at end of file
localdep_windows: install
cd "${installpath}"; ./windep.sh fluidsynth~.dll
localdep_linux: install
cd "${installpath}"; /bin/sh localdeps.linux.sh fluidsynth~.pd_linux
#!/bin/sh
for filename in /usr/local/lib/libfluidsynth*
do
cp $filename ./
done;
\ No newline at end of file
#!/bin/sh
for filename in /usr/local/lib64/libfluidsynth*
do
cp $filename ./
done;
\ No newline at end of file
#!/bin/sh
#
# creates local copies of all dependencies (dynamic libraries)
# and sets RUNPATH to $ORIGIN on each so they will find
# each other.
#
# usage: $0 <binary>
#
# Author: Roman Haefeli <reduzent@gmail.com>
case $1 in
"")
echo "Usage: /bin/sh ${0} <binary>"
exit
;;
*)
binary_file=$1
;;
esac
# List of libraries that we do not include into our packaging
# becaue we think they will be installed on any system
LD_EXCLUDE_LIST="linux-gate\.so.*
linux-vdso\.so.*
libarmmem.*\.so.*
libc.so\.*
ld-linux.*\.so.*
libdl\.so.*
libglib-.*\.so.*
libgomp\.so.*
libgthread.*\.so.*
libm\.so.*
libpthread.*\.so.*
libstdc++\.so.*
libgcc_s\.so.*
libpcre\.so.*"
# Check dependencies
cmdlist="awk grep ldd patchelf uname"
for cmd in $cmdlist
do
if ! which $cmd > /dev/null
then
echo "Could not find ${cmd}. Is it installed?" > /dev/stderr
exit 1
fi
done
# Set LD_LIBRARY_PATH depending on arch
ARCH=$(uname -m)
case $ARCH in
"x86_64")
LD_LIBRARY_PATH="$HOME/.local/lib:/usr/local/lib64:/usr/lib/x86_64-linux-gnu"
;;
"i686")
LD_LIBRARY_PATH="$HOME/.local/lib:/usr/local/lib:/usr/lib/i386-linux-gnu"
;;
"armv7l")
LD_LIBRARY_PATH="$HOME/.local/lib:/usr/local/lib:/usr/lib/arm-linux-gnueabihf"
;;
*)
echo "Arch '$ARCH' not (yet) supported. Please file a bug report"
exit 1
esac
# Check if we can read from given file
if ! ldd $binary_file > /dev/null 2>&1
then
echo "Can't read '${binary_file}'. Is it a binary file?" > /dev/stderr
exit 1
fi
library_in_exclude_list() {
# arg1: library name
# returns 0 if arg1 is found in exclude list, otherwise 1
libexname="$1"
skip=1
set -f
for expat in $(echo "$LD_EXCLUDE_LIST")
do
if echo "$(basename $libexname)" | grep "${expat}" > /dev/null
then
skip=0
break
fi
done
set +f
return $skip
}
search_make_local_copy() {
# look for given library in all library paths
# and make a local copy of it
# arg1: name of the library to make a local copy of
found=false
IFSold=$IFS
IFS=:
for path in ${LD_LIBRARY_PATH}
do
[ -f "${path}/$1" ] && cp "${path}/$1" . && found=true && break
done
IFS=$IFSold
if ! $found
then
echo "$1 not found" > /dev/stderr
exit 1
fi
}
make_local_copy_and_set_rpath() {
# make a local copy of all linked libraries of given binary
# and set RUNPATH to $ORIGIN (exclude "standard" libraries)
# arg1: binary to check
ldd $1 | while read ldd_line
do
libname=$(echo "$ldd_line" | awk '{ print $1 }')
libpath=$(echo "$ldd_line" | awk '{ print $3 }')
if ! [ -f "$(basename $libname)" ] && ! library_in_exclude_list "$libname"
then
if [ "$libpath" != "" ]
then
cp "$libpath" .
elif echo "$libname" | grep '/' > /dev/null
then
cp "$libname" .
else
echo "Warning: could not make copy of '$libname'. Not found"
fi
fi
if ! library_in_exclude_list "$libname"
then
patchelf --set-rpath \$ORIGIN "$(basename $libname)"
fi
done
}
find_missing() {
# find libraries that are shown as 'not found' in ldd and
# create a local copy of them.
# arg1: binary file to check for missing links
while true
do
ldd_output=$(ldd ${1})
if echo "$ldd_output" | grep '=> not found' > /dev/null
then
next_missing=$(echo "$ldd_output" | grep '=> not found' | head -n1 | awk '{print $1}')
search_make_local_copy "$next_missing"
else
break
fi
done
}
find_missing $binary_file
make_local_copy_and_set_rpath $binary_file
# clean after ourselves
rm $0
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment