2016-03-16 21:30:19 -04:00
#!/bin/bash
2016-04-29 00:03:47 -04:00
rm ${ CMAKE_CURRENT_BINARY_DIR } /CubicSDR.AppImage
2016-03-16 21:30:19 -04:00
rm -rf ${ CMAKE_CURRENT_BINARY_DIR } /CubicSDR.AppDir
mkdir ${ CMAKE_CURRENT_BINARY_DIR } /CubicSDR.AppDir
cp ${ CMAKE_CURRENT_BINARY_DIR } /CubicSDR.desktop ${ CMAKE_CURRENT_BINARY_DIR } /CubicSDR.AppDir/
cp ${ CMAKE_CURRENT_SOURCE_DIR } /src/CubicSDR.png ${ CMAKE_CURRENT_BINARY_DIR } /CubicSDR.AppDir/
cp ${ APPIMAGEKIT_APPRUN } ${ CMAKE_CURRENT_BINARY_DIR } /CubicSDR.AppDir/
2016-04-29 00:03:47 -04:00
chmod +x ${ CMAKE_CURRENT_BINARY_DIR } /CubicSDR.AppDir/AppRun
2016-03-16 21:30:19 -04:00
mkdir -p ${ CMAKE_CURRENT_BINARY_DIR } /CubicSDR.AppDir/usr/bin
2016-06-28 20:13:05 -04:00
mkdir -p ${ CMAKE_CURRENT_BINARY_DIR } /CubicSDR.AppDir/usr/bin/fonts
2016-03-16 21:30:19 -04:00
cp ${ CMAKE_CURRENT_BINARY_DIR } /${ EX_PLATFORM_NAME } /* ${ CMAKE_CURRENT_BINARY_DIR } /CubicSDR.AppDir/usr/bin
2016-06-28 20:13:05 -04:00
cp ${ CMAKE_CURRENT_BINARY_DIR } /${ EX_PLATFORM_NAME } /fonts/* ${ CMAKE_CURRENT_BINARY_DIR } /CubicSDR.AppDir/usr/bin/fonts/
2016-03-16 21:30:19 -04:00
mkdir -p ${ CMAKE_CURRENT_BINARY_DIR } /CubicSDR.AppDir/usr/local/lib/
cp -R /usr/local/lib/SoapySDR ${ CMAKE_CURRENT_BINARY_DIR } /CubicSDR.AppDir/usr/local/lib/
mkdir -p ${ CMAKE_CURRENT_BINARY_DIR } /CubicSDR.AppDir/usr/lib
2016-04-29 00:03:47 -04:00
strip ${ CMAKE_CURRENT_BINARY_DIR } /CubicSDR.AppDir/usr/bin/CubicSDR
2016-03-16 21:30:19 -04:00
2016-03-16 22:51:32 -04:00
IGNORE_PKG = "libc6.* libusb.* libgcc.* libstd.* libudev.* libgtk.* libgdk.* libx.* libpango.* libglib.* libgl.* libcairo.* libfont.* libatk.* libwayland.* libthai.* libpixman.* zlib.* libpcre.* libice.* libuuid.* libpulse.* libjson.* libdbus.* libatspi.* libharf.* libselinux.* libmir.* libboost-system.* libprotobuf.* libdatrie.* libsystem.* libwrap.* libsndfile.* libasync.* libgraphite.* liblzma.* libgcrypt.* libflac.* libvorbis.* libgpg.* libogg.* libsm6 libpng.* libexpat.* libdrm.* libffi.* libfreetype.* libboost-filesystem.* libmirsdr.*"
IGNORE_LIB = "^.*libmirsdr.*"
2016-03-16 21:30:19 -04:00
for f in ` find ${ CMAKE_CURRENT_BINARY_DIR } /CubicSDR.AppDir/usr/local/lib/SoapySDR/modules/ -type f` ${ CMAKE_CURRENT_BINARY_DIR } /${ EX_PLATFORM_NAME } /CubicSDR
do
for l in ` ldd $f | grep so | sed -e '/^[^\t]/ d' | sed -e 's/\t//' | sed -e 's/.*=..//' | sed -e 's/ (0.*)//' `
2016-03-16 22:51:32 -04:00
do
2016-03-16 21:30:19 -04:00
echo " Checking what package owns $l : "
OWNER_PKG = ` apt-file --package-only find $l `
SKIP_PKG = 0
2016-03-16 22:51:32 -04:00
for i in $IGNORE_LIB
do
if [ [ $l = ~ $i ] ] ; then
echo " Ignoring lib $l matching explicit library ignore regex $i "
SKIP_PKG = 1
fi
done
if [ " $OWNER_PKG " = "" ] && [ $SKIP_PKG = 0 ] ; then
echo " *** $l has no package, copying to AppDir.. "
2016-03-16 21:30:19 -04:00
cp $l ${ CMAKE_CURRENT_BINARY_DIR } /CubicSDR.AppDir/usr/lib/
SKIP_PKG = 1
fi
for i in $IGNORE_PKG
do
if [ [ $OWNER_PKG = ~ $i ] ] ; then
echo " Ignoring lib $l in package $OWNER_PKG , matching regex $i "
SKIP_PKG = 1
fi
done
2016-03-16 22:51:32 -04:00
2016-03-16 21:30:19 -04:00
if [ $SKIP_PKG = 0 ] ; then
#SO_FILE=`echo $l | sed 's/\.so\.[^\.]*$//'`.so
2016-03-16 22:51:32 -04:00
echo " *** $OWNER_PKG not in ignore list, copying $l to AppDir.. "
2016-03-16 21:30:19 -04:00
cp $l ${ CMAKE_CURRENT_BINARY_DIR } /CubicSDR.AppDir/usr/lib/
fi
done
done
2016-03-16 22:51:32 -04:00
pushd .
cd ${ CMAKE_CURRENT_BINARY_DIR } /CubicSDR.AppDir/usr/
find . -type f -exec sed -i -e 's|/usr|././|g' { } \;
popd
2016-03-16 21:30:19 -04:00
pushd .
cd ${ CMAKE_CURRENT_BINARY_DIR }
2016-04-29 00:03:47 -04:00
${ APPIMAGEKIT_APPASSIST } CubicSDR.AppDir CubicSDR.AppImage
2016-03-16 21:30:19 -04:00
popd