Merge pull request #2153 from shoogle/debian-packaging

Bringing Debian packaging upstream
This commit is contained in:
Nicolas Froment 2015-08-27 20:16:55 +02:00
commit f07d7bb52b
9 changed files with 144 additions and 64 deletions

View file

@ -72,7 +72,7 @@ option(OCR "enable OCR, requires OMR" OFF) # requires tesser
option(SOUNDFONT3 "ogg vorbis compressed fonts" ON) # enable ogg vorbis compressed fonts, require ogg & vorbis
option(HAS_AUDIOFILE "enable audio export" ON) # requires libsndfile
option(USE_SYSTEM_QTSINGLEAPPLICATION "Use system QtSingleApplication" OFF)
option(BUILD_LAME "enable mp3 export" ON) # requires libmp3lame
option(BUILD_LAME "enable mp3 export" ON) # requires libmp3lame (non-free), call CMake with -DBUILD_LAME="OFF" to disable
SET(JACK_LONGNAME "jack (jack audio connection kit)")
SET(JACK_MIN_VERSION "0.98.0")
@ -131,7 +131,7 @@ else (APPLE)
endif(APPLE)
set(CMAKE_INCLUDE_CURRENT_DIR TRUE)
set(CMAKE_BUILD_WITH_INSTALL_RPATH ON)
set(CMAKE_BUILD_WITH_INSTALL_RPATH ON) # Call CMake with option -DCMAKE_SKIP_RPATH to not set RPATH (Debian packaging requirement)
set(CMAKE_SKIP_RULE_DEPENDENCY TRUE)
# The Mscore version number.
@ -146,6 +146,14 @@ SET(MUSESCORE_NAME_VERSION "${MUSESCORE_NAME} ${MUSESCORE_VERSION_MAJOR}")
#
SET(MUSESCORE_VERSION_FULL "${MUSESCORE_VERSION}.${MUSESCORE_VERSION_PATCH}")
if (MUSESCORE_LABEL)
SET (MUSESCORE_NAME_VERSION "${MUSESCORE_NAME_VERSION} ${MUSESCORE_LABEL}")
endif (MUSESCORE_LABEL)
if (MSCORE_UNSTABLE)
SET (MUSESCORE_NAME_VERSION "${MUSESCORE_NAME_VERSION} (${MUSESCORE_VERSION_FULL} unstable)")
endif (MSCORE_UNSTABLE)
if (MINGW OR APPLE)
if(MINGW)
SET(Mscore_INSTALL_NAME "")
@ -155,7 +163,7 @@ if (MINGW OR APPLE)
SET(Mscore_SHARE_NAME "mscore.app/")
endif(MINGW)
else (MINGW OR APPLE)
SET(Mscore_INSTALL_NAME "mscore-${MUSESCORE_VERSION}/")
SET(Mscore_INSTALL_NAME "mscore${MSCORE_INSTALL_SUFFIX}-${MUSESCORE_VERSION}/")
SET(Mscore_SHARE_NAME "share/")
endif (MINGW OR APPLE)
@ -395,31 +403,44 @@ configure_file (
)
if (NOT MINGW AND NOT APPLE)
#### PACKAGING for Linux and BSD based systems (more in mscore/CMakeLists.txt) ####
#
# set library search path for runtime linker to load the same
# qt libraries as we used at compile time
#
set (CMAKE_EXE_LINKER_FLAGS "-Wl,-rpath=${_qt5Core_install_prefix}/lib")
# install desktop file
install( FILES build/mscore.desktop DESTINATION share/applications)
SET(CMAKE_INSTALL_RPATH "${_qt5Core_install_prefix}/lib") # ignored if CMAKE_SKIP_RPATH="TRUE"
# install desktop file (perform variable substitution first)
configure_file(build/mscore.desktop.in mscore${MSCORE_INSTALL_SUFFIX}.desktop)
install( FILES ${PROJECT_BINARY_DIR}/mscore${MSCORE_INSTALL_SUFFIX}.desktop DESTINATION share/applications)
# substitute variables within man pages
set(MAN_NAME mscore)
set(MAN_ALIAS musescore)
set(MAN_EXTENSION .1)
set(MAN_FULL_NAME ${MAN_NAME}${MSCORE_INSTALL_SUFFIX}${MAN_EXTENSION})
set(MAN_FULL_ALIAS ${MAN_ALIAS}${MSCORE_INSTALL_SUFFIX}${MAN_EXTENSION})
set(MAN_TARGET ${PROJECT_SOURCE_DIR}/build/${MAN_NAME}${MAN_EXTENSION}.in)
set(MAN_BUILD ${PROJECT_BINARY_DIR}/${MAN_FULL_NAME})
configure_file(${MAN_TARGET} ${MAN_BUILD})
# compress man pages if gzip is installed (don't on OpenBSD)
# note: compressing man pages is normal on Linux but not OpenBSD
set(MAN_TARGET ${PROJECT_SOURCE_DIR}/build/mscore.1)
find_program( GZIP_EXECUTABLE gzip DOC "A tool for compressing manpages (optional)." )
if (GZIP_EXECUTABLE AND NOT CMAKE_SYSTEM_NAME MATCHES "OpenBSD")
message(STATUS "Found gzip. Man pages will be compressed.")
set(MAN_BUILD ${PROJECT_BINARY_DIR}/mscore.1.gz)
set(MAN_TARGET ${MAN_BUILD})
set(MAN_EXTENSION ${MAN_EXTENSION}.gz)
set(MAN_FULL_NAME ${MAN_NAME}${MSCORE_INSTALL_SUFFIX}${MAN_EXTENSION})
set(MAN_FULL_ALIAS ${MAN_ALIAS}${MSCORE_INSTALL_SUFFIX}${MAN_EXTENSION})
set(MAN_BUILD ${PROJECT_BINARY_DIR}/${MAN_FULL_NAME})
add_custom_command(
OUTPUT ${MAN_BUILD}
DEPENDS ${MAN_TARGET}
COMMAND ${GZIP_EXECUTABLE} < ${MAN_TARGET} > ${MAN_BUILD}
COMMAND ${GZIP_EXECUTABLE} -9 < ${MAN_TARGET} > ${MAN_BUILD}
)
add_custom_target(manpages
DEPENDS ${MAN_BUILD}
COMMAND echo "Man pages have been compressed ready for installation."
VERBATIM
)
set(MAN_TARGET ${MAN_BUILD})
else (GZIP_EXECUTABLE AND NOT CMAKE_SYSTEM_NAME MATCHES "OpenBSD")
if (CMAKE_SYSTEM_NAME MATCHES "OpenBSD")
message(STATUS "System is OpenBSD: Man pages will not be compressed.")
@ -432,9 +453,24 @@ if (NOT MINGW AND NOT APPLE)
)
endif (GZIP_EXECUTABLE AND NOT CMAKE_SYSTEM_NAME MATCHES "OpenBSD")
# install man pages in either compressed or uncompressed form
install( FILES ${MAN_TARGET} DESTINATION share/man/man1 COMPONENT doc)
install( FILES ${MAN_BUILD} DESTINATION share/man/man1 COMPONENT doc)
# create symlink alias for man pages so `man musescore` = `man mscore`
find_program( LN_EXECUTABLE ln DOC "A tool for creating symbolic link aliases (optional)." )
if (LN_EXECUTABLE)
message(STATUS "Found ln. Symlink aliases will be created for MuseScore executable and the man pages.")
add_custom_command(
TARGET manpages
COMMAND echo "Creating symlink alias for man pages."
COMMAND ${LN_EXECUTABLE} -sf "${MAN_FULL_NAME}" "${MAN_FULL_ALIAS}"
COMMAND echo 'Symlink alias: ${MAN_FULL_ALIAS} -> ${MAN_FULL_NAME}'
)
install( FILES ${PROJECT_BINARY_DIR}/${MAN_FULL_ALIAS} DESTINATION share/man/man1 COMPONENT doc)
else (LN_EXECUTABLE)
message(STATUS "ln not found (it is optional). No symlink aliases will be created.")
endif (LN_EXECUTABLE)
# add .MSCZ and .MSCX to MIME database (informs system that filetypes .MSCZ & .MSCX are MuseScore files)
install( FILES ${PROJECT_SOURCE_DIR}/build/musescore.xml DESTINATION share/mime/packages COMPONENT doc)
configure_file(build/musescore.xml.in musescore${MSCORE_INSTALL_SUFFIX}.xml)
install( FILES ${PROJECT_BINARY_DIR}/musescore${MSCORE_INSTALL_SUFFIX}.xml DESTINATION share/mime/packages COMPONENT doc)
# Note: must now run "update-mime-database" to apply changes. This is done in the Makefile.
endif (NOT MINGW AND NOT APPLE)

View file

@ -29,6 +29,14 @@ PREFIX = "/usr/local"
VERSION = "2.1b-${REVISION}"
#VERSION = 2.1.0
# Override SUFFIX and LABEL when multiple versions are installed to avoid conflicts.
SUFFIX=""# E.g.: SUFFIX="dev" --> "mscore" becomes "mscoredev"
LABEL=""# E.g.: LABEL="Development Build" --> "MuseScore 2" becomes "MuseScore 2 Development Build"
BUILD_LAME="ON"# Non-free, required for MP3 support. Override with "OFF" to disable.
UPDATE_CACHE="TRUE"# Override if building a DEB or RPM, or when installing to a non-standard location.
NO_RPATH="FALSE"# Package maintainers may want to override this (e.g. Debian)
#
# change path to include your Qt5 installation
#
@ -39,9 +47,14 @@ release:
cd build.release; \
export PATH=${BINPATH}; \
cmake -DCMAKE_BUILD_TYPE=RELEASE \
-DCMAKE_INSTALL_PREFIX="${PREFIX}" ..; \
-DCMAKE_INSTALL_PREFIX="${PREFIX}" \
-DMSCORE_INSTALL_SUFFIX="${SUFFIX}" \
-DMUSESCORE_LABEL="${LABEL}" \
-DBUILD_LAME="${BUILD_LAME}" \
-DCMAKE_SKIP_RPATH="${NO_RPATH}" ..; \
make lrelease; \
make manpages; \
make mscore_alias; \
make -j ${CPUS}; \
@ -49,10 +62,15 @@ debug:
if test ! -d build.debug; then mkdir build.debug; fi; \
cd build.debug; \
export PATH=${BINPATH}; \
cmake -DCMAKE_BUILD_TYPE=DEBUG \
-DCMAKE_INSTALL_PREFIX="${PREFIX}" ..; \
cmake -DCMAKE_BUILD_TYPE=DEBUG \
-DCMAKE_INSTALL_PREFIX="${PREFIX}" \
-DMSCORE_INSTALL_SUFFIX="${SUFFIX}" \
-DMUSESCORE_LABEL="${LABEL}" \
-DBUILD_LAME="${BUILD_LAME}" \
-DCMAKE_SKIP_RPATH="${NO_RPATH}" ..; \
make lrelease; \
make manpages; \
make mscore_alias; \
make -j ${CPUS}; \
@ -97,26 +115,34 @@ version:
install: release
cd build.release \
&& make install/strip \
&& update-mime-database "${PREFIX}/share/mime" \
&& gtk-update-icon-cache -f -t "${PREFIX}/share/icons/hicolor"
&& if [ ${UPDATE_CACHE} = "TRUE" ]; then \
update-mime-database "${PREFIX}/share/mime"; \
gtk-update-icon-cache -f -t "${PREFIX}/share/icons/hicolor"; \
fi
installdebug: debug
cd build.debug \
&& make install \
&& update-mime-database "${PREFIX}/share/mime" \
&& gtk-update-icon-cache -f -t "${PREFIX}/share/icons/hicolor"
&& if [ ${UPDATE_CACHE} = "TRUE" ]; then \
update-mime-database "${PREFIX}/share/mime"; \
gtk-update-icon-cache -f -t "${PREFIX}/share/icons/hicolor"; \
fi
uninstall:
cd build.release \
&& xargs rm < install_manifest.txt \
&& update-mime-database "${PREFIX}/share/mime" \
&& gtk-update-icon-cache -f -t "${PREFIX}/share/icons/hicolor"
&& if [ ${UPDATE_CACHE} = "TRUE" ]; then \
update-mime-database "${PREFIX}/share/mime"; \
gtk-update-icon-cache -f -t "${PREFIX}/share/icons/hicolor"; \
fi
uninstalldebug:
cd build.debug \
&& xargs rm < install_manifest.txt \
&& update-mime-database "${PREFIX}/share/mime" \
&& gtk-update-icon-cache -f -t "${PREFIX}/share/icons/hicolor"
&& if [ ${UPDATE_CACHE} = "TRUE" ]; then \
update-mime-database "${PREFIX}/share/mime"; \
gtk-update-icon-cache -f -t "${PREFIX}/share/icons/hicolor"; \
fi
#
# linux

View file

@ -32,9 +32,10 @@
#cmakedefine HAS_AUDIOFILE
#cmakedefine USE_SSE
#define INSTALL_NAME "${Mscore_INSTALL_NAME}"
#define INSTPREFIX "${CMAKE_INSTALL_PREFIX}"
#define VERSION "${MUSESCORE_VERSION_FULL}"
#define MUSESCORE_NAME_VERSION "${MUSESCORE_NAME_VERSION}"
#define INSTALL_NAME "${Mscore_INSTALL_NAME}"
#define INSTPREFIX "${CMAKE_INSTALL_PREFIX}"
#define VERSION "${MUSESCORE_VERSION_FULL}"
#cmakedefine AEOLUS
#cmakedefine ZERBERUS

View file

@ -19,13 +19,13 @@
.\" TeX users may be more comfortable with the \fB<whatever>\fP and
.\" \fI<whatever>\fP escape sequences to invode bold face and italics,
.\" respectively.
.SH NAME
\fBmscore\fP \- MuseScore sheet music editor.
.SH NAME@Variables_substituted_by_CMAKE_on_installation@
\fBmscore@MSCORE_INSTALL_SUFFIX@\fP \- @MUSESCORE_NAME_VERSION@ sheet music editor.
MuseScore is a free and open source WYSIWYG typesetting program for musical scores, released under the GNU General Public Licence.
.SH SYNOPSIS
.B mscore
.B mscore@MSCORE_INSTALL_SUFFIX@
.RI [ options ]
.RI [ filename(s) ]

View file

@ -1,16 +0,0 @@
[Desktop Entry]
Version=2.0
Comment=Create, play and print sheet music
Comment[ru]=Визуальный редактор нотных партитур
Comment[fr]=Gravure de partitions musicales
Exec=mscore %F
GenericName=Music notation
GenericName[de]=Notensatz
GenericName[fr]=Notation musicale
Icon=mscore
Name=MuseScore
StartupNotify=true
Terminal=false
Type=Application
Categories=Qt;Audio;Sequencer;Midi;AudioVideoEditing;Music;AudioVideo;
MimeType=application/x-musescore;application/x-musescore+xml;application/vnd.recordare.musicxml;application/vnd.recordare.musicxml+xml;

16
build/mscore.desktop.in Normal file
View file

@ -0,0 +1,16 @@
[Desktop Entry]
Version=1.1@This_is_version_of_Desktop_Entry_Specification@@It_is_NOT_MuseScore_version@
Name=@MUSESCORE_NAME_VERSION@@Variables_substituted_by_CMAKE_on_installation@
GenericName=Music notation
GenericName[de]=Notensatz
GenericName[fr]=Notation musicale
Comment=Create, play and print sheet music
Comment[ru]=Визуальный редактор нотных партитур
Comment[fr]=Gravure de partitions musicales
Exec=mscore@MSCORE_INSTALL_SUFFIX@ %F
Icon=mscore@MSCORE_INSTALL_SUFFIX@
StartupNotify=true
Terminal=false
Type=Application
Categories=Qt;Audio;Sequencer;Midi;AudioVideoEditing;Music;AudioVideo;
MimeType=application/x-musescore@MSCORE_INSTALL_SUFFIX@;application/x-musescore@MSCORE_INSTALL_SUFFIX@+xml;application/vnd.recordare.musicxml@MSCORE_INSTALL_SUFFIX@;application/vnd.recordare.musicxml@MSCORE_INSTALL_SUFFIX@+xml;

View file

@ -1,16 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
<mime-type type="application/x-musescore">
<mime-type type="application/x-musescore@MSCORE_INSTALL_SUFFIX@">@Variables_substituted_by_CMAKE_on_installation@
<comment>MuseScore file</comment>
<sub-class-of type="application/zip"/>
<glob pattern="*.mscz"/>
</mime-type>
<mime-type type="application/x-musescore+xml">
<mime-type type="application/x-musescore@MSCORE_INSTALL_SUFFIX@+xml">
<comment>uncompressed MuseScore file</comment>
<sub-class-of type="application/xml"/>
<glob pattern="*.mscx" />
</mime-type>
<mime-type type="application/vnd.recordare.musicxml">
<mime-type type="application/vnd.recordare.musicxml@MSCORE_INSTALL_SUFFIX@">
<!-- http://www.musicxml.com/for-developers/musicxml-dtd/ -->
<_comment>MusicXML file</_comment>
<sub-class-of type="application/zip"/>
@ -19,7 +19,7 @@
<!-- <generic-icon name="audio-x-generic"/> Uncomment to use generic audio file icon -->
<glob pattern="*.mxl"/>
</mime-type>
<mime-type type="application/vnd.recordare.musicxml+xml">
<mime-type type="application/vnd.recordare.musicxml@MSCORE_INSTALL_SUFFIX@+xml">
<!-- http://www.musicxml.com/for-developers/musicxml-dtd/ -->
<_comment>uncompressed MusicXML file</_comment>
<sub-class-of type="application/xml"/>

View file

@ -310,6 +310,8 @@ target_link_libraries(mscore
if (MINGW)
set(MSCORE_OUTPUT_NAME ${MUSESCORE_NAME})
elseif (MSCORE_INSTALL_SUFFIX)
set(MSCORE_OUTPUT_NAME "${ExecutableName}${MSCORE_INSTALL_SUFFIX}")
endif (MINGW)
#if MSCORE_OUTPUT_NAME is set (e.g, when cmake is called by the user), the output executable will be
@ -525,28 +527,43 @@ else (MINGW)
install (FILES data/mscore.icns DESTINATION ${Mscore_SHARE_NAME}${Mscore_INSTALL_NAME})
install (FILES data/musescoreDocument.icns DESTINATION ${Mscore_SHARE_NAME}${Mscore_INSTALL_NAME})
else (APPLE)
# Linux: install mscore executable (package maintainers may add "MuseScore" and/or "musescore" aliases that symlink to mscore)
#### PACKAGING for Linux and BSD based systems (more in top-level CMakeLists.txt) ####
# install mscore executable (package maintainers may add "MuseScore" and/or "musescore" aliases that symlink to mscore)
install( TARGETS mscore RUNTIME DESTINATION bin )
if (LN_EXECUTABLE)
add_custom_target(mscore_alias
DEPENDS mscore
COMMAND echo "Creating symlink alias for mscore executable."
COMMAND ${LN_EXECUTABLE} -sf "mscore${MSCORE_INSTALL_SUFFIX}" "musescore${MSCORE_INSTALL_SUFFIX}"
COMMAND echo 'Symlink alias: musescore${MSCORE_INSTALL_SUFFIX} -> mscore${MSCORE_INSTALL_SUFFIX}'
)
install( FILES ${PROJECT_BINARY_DIR}/mscore/musescore${MSCORE_INSTALL_SUFFIX} DESTINATION bin)
else (LN_EXECUTABLE)
add_custom_target(mscore_alias
COMMAND echo "No symlink aliases will be created."
VERBATIM
)
endif (LN_EXECUTABLE)
# install MuseScore icons (use SVGs where possible, but install PNGs as backup for systems that don't support SVG)
install( FILES ../assets/musescore-icon-round.svg RENAME mscore.svg DESTINATION share/icons/hicolor/scalable/apps)
install( FILES ../assets/musescore-icon-round-64.png RENAME mscore.png DESTINATION share/icons/hicolor/64x64/apps)
install( FILES ../assets/musescore-icon-round.svg RENAME mscore${MSCORE_INSTALL_SUFFIX}.svg DESTINATION share/icons/hicolor/scalable/apps)
install( FILES ../assets/musescore-icon-round-64.png RENAME mscore${MSCORE_INSTALL_SUFFIX}.png DESTINATION share/icons/hicolor/64x64/apps)
# install MIME (filetype) icons for each mimetype on Linux
install( FILES ../assets/mscz-icon.svg RENAME application-x-musescore.svg
install( FILES ../assets/mscz-icon.svg RENAME application-x-musescore${MSCORE_INSTALL_SUFFIX}.svg
DESTINATION share/icons/hicolor/scalable/mimetypes) # SVG icon for .MSCZ files
install( FILES ../assets/mscz-icon-48.png RENAME application-x-musescore.png
install( FILES ../assets/mscz-icon-48.png RENAME application-x-musescore${MSCORE_INSTALL_SUFFIX}.png
DESTINATION share/icons/hicolor/48x48/mimetypes) # PNG icon for .MSCZ files
install( FILES ../assets/mscx-icon.svg RENAME application-x-musescore+xml.svg
install( FILES ../assets/mscx-icon.svg RENAME application-x-musescore${MSCORE_INSTALL_SUFFIX}+xml.svg
DESTINATION share/icons/hicolor/scalable/mimetypes) # SVG icon for .MSCX files
install( FILES ../assets/mscx-icon-48.png RENAME application-x-musescore+xml.png
install( FILES ../assets/mscx-icon-48.png RENAME application-x-musescore${MSCORE_INSTALL_SUFFIX}+xml.png
DESTINATION share/icons/hicolor/48x48/mimetypes) # PNG icon for .MSCX files
# use a custom icon for MusicXML files (there isn't a standard icon for MusicXML files)
install( FILES ../assets/mxl-icon.svg RENAME application-vnd.recordare.musicxml.svg
install( FILES ../assets/mxl-icon.svg RENAME application-vnd.recordare.musicxml${MSCORE_INSTALL_SUFFIX}.svg
DESTINATION share/icons/hicolor/scalable/mimetypes) # SVG icon for .MXL (compressed MusicXML) files
install( FILES ../assets/mxl-icon-48.png RENAME application-vnd.recordare.musicxml.png
install( FILES ../assets/mxl-icon-48.png RENAME application-vnd.recordare.musicxml${MSCORE_INSTALL_SUFFIX}.png
DESTINATION share/icons/hicolor/48x48/mimetypes) # PNG icon for .MXL (compressed MusicXML) files
install( FILES ../assets/xml-icon.svg RENAME application-vnd.recordare.musicxml+xml.svg
install( FILES ../assets/xml-icon.svg RENAME application-vnd.recordare.musicxml${MSCORE_INSTALL_SUFFIX}+xml.svg
DESTINATION share/icons/hicolor/scalable/mimetypes) # SVG icon for .XML (MusicXML) files
install( FILES ../assets/xml-icon-48.png RENAME application-vnd.recordare.musicxml+xml.png
install( FILES ../assets/xml-icon-48.png RENAME application-vnd.recordare.musicxml${MSCORE_INSTALL_SUFFIX}+xml.png
DESTINATION share/icons/hicolor/48x48/mimetypes) # PNG icon for .XML (MusicXML) files
# Note: must now run "gtk-update-icon-cache" to set the new icons. This is done in the Makefile.
endif (APPLE)

View file

@ -342,7 +342,7 @@ MuseScore::MuseScore()
: QMainWindow()
{
_sstate = STATE_INIT;
setWindowTitle(QString("MuseScore"));
setWindowTitle(QString(MUSESCORE_NAME_VERSION));
setIconSize(QSize(preferences.iconWidth * guiScaling, preferences.iconHeight * guiScaling));
ucheck = new UpdateChecker();
@ -1357,7 +1357,7 @@ void MuseScore::setCurrentScoreView(ScoreView* view)
}
#endif
if (!cs) {
setWindowTitle("MuseScore");
setWindowTitle(MUSESCORE_NAME_VERSION);
if (_navigator && _navigator->widget()) {
navigator()->setScoreView(view);
navigator()->setScore(0);
@ -1408,9 +1408,9 @@ void MuseScore::setCurrentScoreView(ScoreView* view)
mag->setCurrentIndex(int(view->magIdx()));
if (cs->parentScore())
setWindowTitle("MuseScore: " + cs->parentScore()->name() + "-" + cs->name());
setWindowTitle(MUSESCORE_NAME_VERSION ": " + cs->parentScore()->name() + "-" + cs->name());
else
setWindowTitle("MuseScore: " + cs->name());
setWindowTitle(MUSESCORE_NAME_VERSION ": " + cs->name());
QAction* a = getAction("concert-pitch");
a->setChecked(cs->styleB(StyleIdx::concertPitch));