From 5a4b2ad00026f89b05aaa7bcfedd244f948c4376 Mon Sep 17 00:00:00 2001 From: Andrew Okin Date: Tue, 12 Feb 2013 10:14:23 -0600 Subject: [PATCH 1/5] Linux packaging stuff. --- CMakeLists.txt | 65 ++++++++++++++++++++++++++++++++++++------- dependencies.cmake.in | 8 +++++- package/linux/MultiMC | 8 ++++++ 3 files changed, 70 insertions(+), 11 deletions(-) create mode 100755 package/linux/MultiMC diff --git a/CMakeLists.txt b/CMakeLists.txt index f67b83461..15e649e39 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -175,31 +175,76 @@ add_executable(MultiMC ${MULTIMC_SOURCES} ${MULTIMC_HEADERS} ${MULTIMC_UI} ${MUL qt5_use_modules(MultiMC Widgets Network) target_link_libraries(MultiMC quazip patchlib ${MultiMC_LINK_ADDITIONAL_LIBS}) add_dependencies(MultiMC MultiMCLauncher) + +IF (WIN32) install(TARGETS MultiMC RUNTIME DESTINATION .) +ELSE() +install(TARGETS MultiMC RUNTIME DESTINATION bin) +ENDIF() + + + +# Extra libs and files to package. + +# Image format plugins. +SET(IMAGE_FORMAT_PLUGINS svg ico gif jpeg) IF(WIN32) + +# Windows + IF(CMAKE_BUILD_TYPE STREQUAL "Debug") SET(D "d") ELSE() SET(D "") ENDIF() -install(FILES "${Qt5_DIR}/plugins/platforms/qwindows${D}.dll" DESTINATION platforms) -install(FILES "${Qt5_DIR}/plugins/platforms/qminimal${D}.dll" DESTINATION platforms) -install(FILES "${Qt5_DIR}/bin/libEGL${D}.dll" DESTINATION .) +# Install platform plugins. +SET(PLATFORM_PLUGINS windows minimal) +FOREACH(PLATFORM_PLUGIN ${PLATFORM_PLUGINS}) + INSTALL(FILES "${Qt5_DIR}/plugins/platforms/q${PLATFORM_PLUGIN}${D}.dll" DESTINATION platforms) +ENDFOREACH() -install(FILES "${Qt5_DIR}/plugins/imageformats/qsvg${D}.dll" DESTINATION imageformats) -install(FILES "${Qt5_DIR}/plugins/imageformats/qico${D}.dll" DESTINATION imageformats) -install(FILES "${Qt5_DIR}/plugins/imageformats/qgif${D}.dll" DESTINATION imageformats) -install(FILES "${Qt5_DIR}/plugins/imageformats/qjpeg${D}.dll" DESTINATION imageformats) +# Install image format plugins. +FOREACH(IMGFMT_PLUGIN ${IMAGE_FORMAT_PLUGINS}) + INSTALL(FILES "${Qt5_DIR}/plugins/imageformats/q${IMGFMT_PLUGIN}${D}.dll" DESTINATION imageformats) +ENDFOREACH() + +# Additional libs +INSTALL(FILES "${Qt5_DIR}/bin/libEGL${D}.dll" DESTINATION .) ELSEIF(UNIX) IF (APPLE) + +# OS X +# TODO: OS X packaging support + ELSE() -install(FILES "${Qt5_DIR}/plugins/platforms/libqlinuxfb.so" DESTINATION platforms) -install(FILES "${Qt5_DIR}/plugins/platforms/libqminimal.so" DESTINATION platforms) -install(FILES "${Qt5_DIR}/plugins/platforms/libqxcb.so" DESTINATION platforms) +# Linux + +# Install platform plugins. +SET(PLATFORM_PLUGINS linuxfb xcb minimal) +FOREACH(PLATFORM_PLUGIN ${PLATFORM_PLUGINS}) + INSTALL(FILES "${Qt5_DIR}/plugins/platforms/libq${PLATFORM_PLUGIN}.so" DESTINATION platforms) +ENDFOREACH() + +# Install image format plugins. +FOREACH(IMGFMT_PLUGIN ${IMAGE_FORMAT_PLUGINS}) + INSTALL(FILES "${Qt5_DIR}/plugins/imageformats/libq${IMGFMT_PLUGIN}.so" DESTINATION imageformats) +ENDFOREACH() + +# Install ICU libs. +SET(ICU_LIBS data i18n io le lx test tu uc) +FOREACH(ICU_LIB ${ICU_LIBS}) + INSTALL(FILES "/usr/lib/libicu${ICU_LIB}.so.48.1.1" DESTINATION lib) +ENDFOREACH() + +# Install additional libs. +INSTALL(FILES "${Qt5_DIR}/lib/libQt5DBus.so.5.0.1" DESTINATION lib RENAME libQt5DBus.so.5) + +# Install the start script. +INSTALL(FILES "${CMAKE_CURRENT_SOURCE_DIR}/package/linux/MultiMC" DESTINATION .) ENDIF() ENDIF() diff --git a/dependencies.cmake.in b/dependencies.cmake.in index 408bb8111..9d4d1f639 100644 --- a/dependencies.cmake.in +++ b/dependencies.cmake.in @@ -4,6 +4,12 @@ message(STATUS "Running install script...") SET(Qt5_DIR @Qt5_DIR@) +IF(WIN32) +SET(LIB_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX}) +ELSE() +SET(LIB_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX}/lib) +ENDIF() + INCLUDE(GetPrerequisites) GET_PREREQUISITES(@BINARY_LOCATION@ MULTIMC_PREREQS 1 1 "" "") @@ -19,7 +25,7 @@ FOREACH(PREREQ ${MULTIMC_PREREQS}) message(STATUS "Adding install prerequisite: ${PREREQ_NAME}") FILE(INSTALL - DESTINATION "${CMAKE_INSTALL_PREFIX}" + DESTINATION "${LIB_INSTALL_PREFIX}" TYPE PROGRAM RENAME "${PREREQ_NAME}" FILES "${PREREQ_ACTUAL}" diff --git a/package/linux/MultiMC b/package/linux/MultiMC new file mode 100755 index 000000000..20ecb6d11 --- /dev/null +++ b/package/linux/MultiMC @@ -0,0 +1,8 @@ +#!/bin/sh +# Basic start script for running MultiMC with the libs packaged with it. + +MMC_DIR = $(dirname "$0") +cd "${MMC_DIR}" + +export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:"./lib" +exec ./bin/MultiMC From 397c0cb5559768e38f15700f1ed155dd06f35bc8 Mon Sep 17 00:00:00 2001 From: Andrew Date: Tue, 12 Feb 2013 11:57:18 -0600 Subject: [PATCH 2/5] Fixed install to automatically include required DLLs. Suck it, DLL hell! --- CMakeLists.txt | 75 ++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 61 insertions(+), 14 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 15e649e39..55645e3c1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -186,9 +186,39 @@ ENDIF() # Extra libs and files to package. +IF(WIN32) +SET(LIB_INSTALL_PREFIX .) +SET(LIB_INSTALL_PREFIX_ABS ${CMAKE_INSTALL_PREFIX}) +ELSE() +SET(LIB_INSTALL_PREFIX lib) +SET(LIB_INSTALL_PREFIX_ABS ${CMAKE_INSTALL_PREFIX}/lib) +ENDIF() + + # Image format plugins. SET(IMAGE_FORMAT_PLUGINS svg ico gif jpeg) +INCLUDE(GetPrerequisites) + +MACRO(INCLUDE_DLL_DEPS DLL_FILE DEST) +GET_PREREQUISITES(${DLL_FILE} DLL_PREREQS 1 1 "" "") + +INSTALL(FILES ${DLL_FILE} DESTINATION ${DEST}) + +FOREACH(PREREQ ${DLL_PREREQS}) + GET_FILENAME_COMPONENT(PREREQ_NAME "${PREREQ}" NAME) + GET_FILENAME_COMPONENT(PREREQ_ACTUAL "${PREREQ}" REALPATH) + IF(WIN32) + SET(PREREQ_ACTUAL "${Qt5_DIR}/bin/${PREREQ}") + ENDIF() + + MESSAGE(STATUS "Adding install prerequisite: ${PREREQ_NAME}") + + INSTALL(FILES ${PREREQ_ACTUAL} RENAME ${PREREQ_NAME} DESTINATION ${LIB_INSTALL_PREFIX}) +ENDFOREACH() +ENDMACRO() + + IF(WIN32) # Windows @@ -202,17 +232,14 @@ ENDIF() # Install platform plugins. SET(PLATFORM_PLUGINS windows minimal) FOREACH(PLATFORM_PLUGIN ${PLATFORM_PLUGINS}) - INSTALL(FILES "${Qt5_DIR}/plugins/platforms/q${PLATFORM_PLUGIN}${D}.dll" DESTINATION platforms) + INCLUDE_DLL_DEPS("${Qt5_DIR}/plugins/platforms/q${PLATFORM_PLUGIN}${D}.dll" platforms) ENDFOREACH() # Install image format plugins. FOREACH(IMGFMT_PLUGIN ${IMAGE_FORMAT_PLUGINS}) - INSTALL(FILES "${Qt5_DIR}/plugins/imageformats/q${IMGFMT_PLUGIN}${D}.dll" DESTINATION imageformats) + INCLUDE_DLL_DEPS("${Qt5_DIR}/plugins/imageformats/q${IMGFMT_PLUGIN}${D}.dll" imageformats) ENDFOREACH() -# Additional libs -INSTALL(FILES "${Qt5_DIR}/bin/libEGL${D}.dll" DESTINATION .) - ELSEIF(UNIX) IF (APPLE) @@ -226,22 +253,23 @@ ELSE() # Install platform plugins. SET(PLATFORM_PLUGINS linuxfb xcb minimal) FOREACH(PLATFORM_PLUGIN ${PLATFORM_PLUGINS}) - INSTALL(FILES "${Qt5_DIR}/plugins/platforms/libq${PLATFORM_PLUGIN}.so" DESTINATION platforms) + INCLUDE_DLL_DEPS("${Qt5_DIR}/plugins/platforms/libq${PLATFORM_PLUGIN}.so" platforms) ENDFOREACH() # Install image format plugins. FOREACH(IMGFMT_PLUGIN ${IMAGE_FORMAT_PLUGINS}) - INSTALL(FILES "${Qt5_DIR}/plugins/imageformats/libq${IMGFMT_PLUGIN}.so" DESTINATION imageformats) + INCLUDE_DLL_DEPS("${Qt5_DIR}/plugins/imageformats/libq${IMGFMT_PLUGIN}.so" imageformats) ENDFOREACH() +# This stuff *should* be added automatically by the INCLUDE_DLL_DEPS macro. # Install ICU libs. -SET(ICU_LIBS data i18n io le lx test tu uc) -FOREACH(ICU_LIB ${ICU_LIBS}) - INSTALL(FILES "/usr/lib/libicu${ICU_LIB}.so.48.1.1" DESTINATION lib) -ENDFOREACH() +#SET(ICU_LIBS data i18n io le lx test tu uc) +#FOREACH(ICU_LIB ${ICU_LIBS}) +# INSTALL(FILES "/usr/lib/libicu${ICU_LIB}.so.48.1.1" DESTINATION lib) +#ENDFOREACH() # Install additional libs. -INSTALL(FILES "${Qt5_DIR}/lib/libQt5DBus.so.5.0.1" DESTINATION lib RENAME libQt5DBus.so.5) +#INSTALL(FILES "${Qt5_DIR}/lib/libQt5DBus.so.5.0.1" DESTINATION lib RENAME libQt5DBus.so.5) # Install the start script. INSTALL(FILES "${CMAKE_CURRENT_SOURCE_DIR}/package/linux/MultiMC" DESTINATION .) @@ -269,6 +297,25 @@ IF(UNIX) ELSEIF(WIN32) SET(CPACK_GENERATOR "ZIP") ENDIF() -set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY 0) -set(CPACK_PACKAGE_FILE_NAME "MultiMC") +SET(CPACK_INCLUDE_TOPLEVEL_DIRECTORY 0) + +SET(CPACK_GENERATOR NSIS) +SET(CPACK_PACKAGE_NAME "MultiMC 5") +SET(CPACK_PACKAGE_VENDOR "") +SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "MultiMC - Minecraft launcher and management tool.") +SET(CPACK_PACKAGE_VERSION "${MultiMC_VERSION_MAJOR}.${MultiMC_VERSION_MINOR}.${MultiMC_VERSION_REV}.${MultiMC_VERSION_BUILD}") +SET(CPACK_PACKAGE_VERSION_MAJOR ${MultiMC_VERSION_MAJOR}) +SET(CPACK_PACKAGE_VERSION_MINOR ${MultiMC_VERSION_MINOR}) +SET(CPACK_PACKAGE_VERSION_PATCH ${MultiMC_VERSION_REV}) + +IF(CPACK_GENERATOR STREQUAL "NSIS") +SET(CPACK_PACKAGE_FILE_NAME "Setup-MultiMC") +ELSE() +SET(CPACK_PACKAGE_FILE_NAME "MultiMC") +ENDIF() + +IF(WIN32) +SET(CPACK_PACKAGE_INSTALL_DIRECTORY "MultiMC 5") +ENDIF() + INCLUDE(CPack) From 4c5d19a62a7914a8ce77bde4824708d586334108 Mon Sep 17 00:00:00 2001 From: Andrew Okin Date: Tue, 12 Feb 2013 12:49:13 -0600 Subject: [PATCH 3/5] Fixed Linux install / package support in CMakeLists. Fixed Linux start script. --- CMakeLists.txt | 24 +++++++++++++++++------- package/linux/MultiMC | 3 ++- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 55645e3c1..c8b6f95bb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -200,9 +200,11 @@ SET(IMAGE_FORMAT_PLUGINS svg ico gif jpeg) INCLUDE(GetPrerequisites) +# Includes DLL dependencies for the given file. Does not include installed system DLLs. Recursive. MACRO(INCLUDE_DLL_DEPS DLL_FILE DEST) GET_PREREQUISITES(${DLL_FILE} DLL_PREREQS 1 1 "" "") +MESSAGE(STATUS "Installing ${DLL_FILE} and its prerequisites.") INSTALL(FILES ${DLL_FILE} DESTINATION ${DEST}) FOREACH(PREREQ ${DLL_PREREQS}) @@ -212,12 +214,19 @@ FOREACH(PREREQ ${DLL_PREREQS}) SET(PREREQ_ACTUAL "${Qt5_DIR}/bin/${PREREQ}") ENDIF() - MESSAGE(STATUS "Adding install prerequisite: ${PREREQ_NAME}") + MESSAGE(STATUS "Adding install prerequisite for ${DLL_FILE}: ${PREREQ_NAME}") INSTALL(FILES ${PREREQ_ACTUAL} RENAME ${PREREQ_NAME} DESTINATION ${LIB_INSTALL_PREFIX}) ENDFOREACH() ENDMACRO() +MACRO(INSTALL_SYMLINK_DEST LINK_FILENAME DEST) +GET_FILENAME_COMPONENT(DEST_NAME "${LINK_FILENAME}" NAME) +GET_FILENAME_COMPONENT(DEST_ACTUAL "${LINK_FILENAME}" REALPATH) + +INSTALL(FILES "${DEST_ACTUAL}" RENAME "${DEST_NAME}" DESTINATION "${DEST}") +ENDMACRO() + IF(WIN32) @@ -261,12 +270,14 @@ FOREACH(IMGFMT_PLUGIN ${IMAGE_FORMAT_PLUGINS}) INCLUDE_DLL_DEPS("${Qt5_DIR}/plugins/imageformats/libq${IMGFMT_PLUGIN}.so" imageformats) ENDFOREACH() -# This stuff *should* be added automatically by the INCLUDE_DLL_DEPS macro. +# This stuff *should* be added automatically by the INCLUDE_ALL_DLL_DEPS macro. Include them manually just in case. # Install ICU libs. -#SET(ICU_LIBS data i18n io le lx test tu uc) -#FOREACH(ICU_LIB ${ICU_LIBS}) -# INSTALL(FILES "/usr/lib/libicu${ICU_LIB}.so.48.1.1" DESTINATION lib) -#ENDFOREACH() +SET(ICU_LIBS data i18n io le lx test tu uc) +FOREACH(ICU_LIB ${ICU_LIBS}) + INSTALL_SYMLINK_DEST("/usr/lib/libicu${ICU_LIB}.so.48" ${LIB_INSTALL_PREFIX}) +ENDFOREACH() + +INSTALL_SYMLINK_DEST("/usr/lib/libxcb-render-util.so.0" ${LIB_INSTALL_PREFIX}) # Install additional libs. #INSTALL(FILES "${Qt5_DIR}/lib/libQt5DBus.so.5.0.1" DESTINATION lib RENAME libQt5DBus.so.5) @@ -299,7 +310,6 @@ ELSEIF(WIN32) ENDIF() SET(CPACK_INCLUDE_TOPLEVEL_DIRECTORY 0) -SET(CPACK_GENERATOR NSIS) SET(CPACK_PACKAGE_NAME "MultiMC 5") SET(CPACK_PACKAGE_VENDOR "") SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "MultiMC - Minecraft launcher and management tool.") diff --git a/package/linux/MultiMC b/package/linux/MultiMC index 20ecb6d11..235d17c5c 100755 --- a/package/linux/MultiMC +++ b/package/linux/MultiMC @@ -1,8 +1,9 @@ #!/bin/sh # Basic start script for running MultiMC with the libs packaged with it. -MMC_DIR = $(dirname "$0") +MMC_DIR=$(dirname "$0") cd "${MMC_DIR}" export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:"./lib" +export QT_PLUGIN_PATH=$QT_PLUGIN_PATH:"." exec ./bin/MultiMC From 5f8784a62e642e7c79c5dfd94da57d755db2fee3 Mon Sep 17 00:00:00 2001 From: Andrew Date: Tue, 12 Feb 2013 13:25:42 -0600 Subject: [PATCH 4/5] More damn libxcb dependencies. DLL hell is not fun. --- CMakeLists.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c8b6f95bb..877a9699d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -277,7 +277,10 @@ FOREACH(ICU_LIB ${ICU_LIBS}) INSTALL_SYMLINK_DEST("/usr/lib/libicu${ICU_LIB}.so.48" ${LIB_INSTALL_PREFIX}) ENDFOREACH() -INSTALL_SYMLINK_DEST("/usr/lib/libxcb-render-util.so.0" ${LIB_INSTALL_PREFIX}) +SET(XCB_LIBS render-util.so.0 image.so.0 icccm.so.4 sync.so.0 xfixes.so.0) +FOREACH(XCB_LIB ${XCB_LIBS}) + INSTALL_SYMLINK_DEST("/usr/lib/libxcb-${XCB_LIB}" ${LIB_INSTALL_PREFIX}) +ENDFOREACH() # Install additional libs. #INSTALL(FILES "${Qt5_DIR}/lib/libQt5DBus.so.5.0.1" DESTINATION lib RENAME libQt5DBus.so.5) From d1b1d7e800173cb0e165babc625ddab03ea7e653 Mon Sep 17 00:00:00 2001 From: Andrew Okin Date: Tue, 12 Feb 2013 13:59:15 -0600 Subject: [PATCH 5/5] Don't bother installing Qt 5 dependencies. Leave it to the user. Maybe we'll make a debian package or something later. --- CMakeLists.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 877a9699d..a191ea6b0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -270,8 +270,10 @@ FOREACH(IMGFMT_PLUGIN ${IMAGE_FORMAT_PLUGINS}) INCLUDE_DLL_DEPS("${Qt5_DIR}/plugins/imageformats/libq${IMGFMT_PLUGIN}.so" imageformats) ENDFOREACH() +# This just turns into a mess. It's probably better to leave installing dependencies to the user. +IF(INCLUDE_BULLSHIT_DLLS) # This stuff *should* be added automatically by the INCLUDE_ALL_DLL_DEPS macro. Include them manually just in case. -# Install ICU libs. +# Install ICU libs SET(ICU_LIBS data i18n io le lx test tu uc) FOREACH(ICU_LIB ${ICU_LIBS}) INSTALL_SYMLINK_DEST("/usr/lib/libicu${ICU_LIB}.so.48" ${LIB_INSTALL_PREFIX}) @@ -281,9 +283,7 @@ SET(XCB_LIBS render-util.so.0 image.so.0 icccm.so.4 sync.so.0 xfixes.so.0) FOREACH(XCB_LIB ${XCB_LIBS}) INSTALL_SYMLINK_DEST("/usr/lib/libxcb-${XCB_LIB}" ${LIB_INSTALL_PREFIX}) ENDFOREACH() - -# Install additional libs. -#INSTALL(FILES "${Qt5_DIR}/lib/libQt5DBus.so.5.0.1" DESTINATION lib RENAME libQt5DBus.so.5) +ENDIF() # Install the start script. INSTALL(FILES "${CMAKE_CURRENT_SOURCE_DIR}/package/linux/MultiMC" DESTINATION .)