All: Add tool for cleaning up debs spat out by CPack

This commit is contained in:
Jeffrey Pfau 2015-02-14 01:44:48 -08:00
parent 78b70d97f4
commit 545497a7de
2 changed files with 66 additions and 1 deletions

View File

@ -310,7 +310,7 @@ set(CPACK_PACKAGE_VERSION_MAJOR ${LIB_VERSION_MAJOR})
set(CPACK_PACKAGE_VERSION_MINOR ${LIB_VERSION_MINOR})
set(CPACK_PACKAGE_VERSION_PATCH ${LIB_VERSION_PATCH})
set(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_SOURCE_DIR}/LICENSE)
set(CPACK_RESOURCE_FILE_README ${CMAKE_SOURCE_DIR}/LICENSE)
set(CPACK_RESOURCE_FILE_README ${CMAKE_SOURCE_DIR}/README.md)
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "mGBA Game Boy Advance Emulator")
set(CPACK_PACKAGE_VENDOR "Jeffrey Pfau")
@ -318,8 +318,12 @@ set(CPACK_PACKAGE_CONTACT "Jeffrey Pfau <jeffrey@endrift.com>")
set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_SOURCE_DIR}/README.md")
set(CPACK_DEBIAN_PACKAGE_SECTION "games")
SET(CPACK_DEB_COMPONENT_INSTALL ON)
set(CPACK_STRIP_FILES ${BINARY_NAME})
install(FILES ${CMAKE_SOURCE_DIR}/README.md ${CMAKE_SOURCE_DIR}/CHANGES DESTINATION ${CMAKE_INSTALL_DOCDIR} COMPONENT lib${BINARY_NAME})
include(CPack)
# Summaries

61
tools/sanitize-deb.sh Executable file
View File

@ -0,0 +1,61 @@
#!/bin/sh
# Clean up the caveats that CPack leaves behind
BINARY=mgba
rmdep () {
local DEP=$1
echo Removing dependency $DEP
sed -i~ "s/[^, ]*$DEP[^,]*//g" deb-temp/DEBIAN/control
}
adddep() {
local DEP=$1
echo Adding dependency $DEP
sed -i~ "s/^Depends: /&$DEP,/" deb-temp/DEBIAN/control
}
while [ $# -gt 0 ]; do
DEB=$1
dpkg-deb -R $DEB deb-temp
mv $DEB $DEB~
sed -i~ s/mgba-// deb-temp/DEBIAN/control
PKG=`head -n1 deb-temp/DEBIAN/control | cut -f2 -d ' '`
echo Found pacakge $PKG
case $PKG in
lib$BINARY)
rmdep sdl
rmdep qt
;;
$BINARY-qt)
rmdep libav
rmdep libedit
rmdep libpng
rmdep libzip
rmdep libmagickwand
rmdep libswscale
rmdep zlib
adddep lib$BINARY
;;
$BINARY-sdl)
rmdep libav
rmdep libedit
rmdep libpng
rmdep qt
rmdep libzip
rmdep libmagickwand
rmdep libswscale
rmdep zlib
adddep lib$BINARY
;;
*)
echo Unknown package!
esac
sed -i~ "s/,,*/,/g" deb-temp/DEBIAN/control
sed -i~ "s/,$//g" deb-temp/DEBIAN/control
sed -i~ "/^[^:]*: $/d" deb-temp/DEBIAN/control
rm deb-temp/DEBIAN/control~
dpkg-deb -b deb-temp $DEB
shift
done