← Back to team overview

maria-developers team mailing list archive

Windows installer

 

Hi everyone,

I have been looking at getting our binary windows distribution back on track. One of the options would be to create the zip file like we did earlier.

Another way would be to create a proper windows installer. For this, there are several options: NSIS, WIX, etc. I spent a bit of time investigating the CPack parts of CMake. And during the investigation, I managed to pretty much write an entire installer. It was quite easy.

The way this works is to add INSTALL instructions in the CMakeFiles.txt, plus a bit of extra information for building the installer package. You can see this in the patch I have attached.

With the patch applied, you have to install NSIS (http://nsis.sourceforge.net) and add it to the path. Build MariaDB in release, and run "cpack" in the MariaDB tree. It's NSIS based because this seems to be the one cpack works best with.

The question is what direction to continue in. I'd appreciate some feedback on this, because I'm not certain if it's the right way to go. It has been pretty easy so far, so I'm pretty happy to continue with it.

IMHO, the most important thing not implemented in this installer yet is to set up MariaDB as a service.

I'm going to focus on getting Windows running in KVM for our buildbot system now. And then I'll get back to this later.

Cheers,

Bo Thorsen.
=== modified file 'CMakeLists.txt'
--- CMakeLists.txt	2010-03-04 08:03:07 +0000
+++ CMakeLists.txt	2010-05-07 13:30:01 +0000
@@ -334,3 +334,72 @@
   ADD_SUBDIRECTORY(libmysqld/examples)
 ENDIF(WITH_EMBEDDED_SERVER)
 ADD_SUBDIRECTORY(mysql-test/lib/My/SafeProcess)
+
+# Set up the installer
+SET(CPACK_PACKAGE_NAME "MariaDB")
+STRING(REPLACE "-MariaDB" "" CPACK_PACKAGE_VERSION ${VERSION})
+SET(CPACK_PACKAGE_VENDOR "Monty Program AB http://www.montyprogram.com";)
+SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "MariaDB")
+SET(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_SOURCE_DIR}/COPYING)
+SET(CPACK_GENERATOR NSIS)
+
+# Installer components and grouping
+SET(CPACK_COMPONENT_GROUP_SERVER_DESCRIPTION "The files necessary for running the MariaDB server.")
+SET(CPACK_COMPONENT_GROUP_DEVELOPMENT_DESCRIPTION "Files used in development on the MariaDB server.")
+SET(CPACK_ALL_INSTALL_TYPES Normal Development)
+SET(CPACK_COMPONENT_RUNTIME_DISPLAY_NAME "MariaDB server")
+SET(CPACK_COMPONENT_RUNTIME_DESCRIPTION "The server itself. You want to install this one.")
+SET(CPACK_COMPONENT_RUNTIME_GROUP "Server")
+SET(CPACK_COMPONENT_RUNTIME_INSTALL_TYPES Normal Development)
+SET(CPACK_COMPONENT_DATA_DISPLAY_NAME "Empty server data files")
+SET(CPACK_COMPONENT_DATA_DESCRIPTION "Empty server data files. These should not be installed for upgrading, only on initial installation.")
+SET(CPACK_COMPONENT_DATA_DEPENDS runtime)
+SET(CPACK_COMPONENT_DATA_GROUP "Server")
+SET(CPACK_COMPONENT_DATA_INSTALL_TYPES Normal Development)
+SET(CPACK_COMPONENT_HEADERS_DISPLAY_NAME "Development headers")
+SET(CPACK_COMPONENT_HEADERS_DESCRIPTION "Header files for development on MariaDB.")
+SET(CPACK_COMPONENT_HEADERS_DEPENDS runtime)
+SET(CPACK_COMPONENT_HEADERS_GROUP "Development")
+SET(CPACK_COMPONENT_HEADERS_INSTALL_TYPES Development)
+SET(CPACK_COMPONENT_PERLSCRIPTS_DISPLAY_NAME "Server perl scripts")
+SET(CPACK_COMPONENT_PERLSCRIPTS_DESCRIPTION "Scripts to controll and modify the server. You need a perl installation for these to work.")
+SET(CPACK_COMPONENT_PERLSCRIPTS_DEPENDS runtime)
+SET(CPACK_COMPONENT_PERLSCRIPTS_GROUP "Server")
+SET(CPACK_COMPONENT_PERLSCRIPTS_INSTALL_TYPES Normal Development)
+# TODO: Add debug files
+# TODO: Add embedded server files
+# TODO: Add test files
+# TODO: Add sql-bench
+
+# Add files to the installer
+INSTALL(FILES COPYING EXCEPTIONS-CLIENT DESTINATION .)
+INSTALL(FILES support-files/my-huge.ini support-files/my-innodb-heavy-4G.ini DESTINATION .)
+INSTALL(FILES support-files/my-large.ini support-files/my-medium.ini DESTINATION .)
+INSTALL(FILES support-files/my-small.ini DESTINATION .)
+INSTALL(FILES Docs/INSTALL-BINARY DESTINATION Docs)
+INSTALL(FILES COPYING DESTINATION Docs)
+FILE(GLOB headerfiles "${CMAKE_CURRENT_SOURCE_DIR}/include/*.h")
+INSTALL(FILES ${headerfiles} DESTINATION include COMPONENT headers)
+INSTALL(FILES include/mysql/plugin.h DESTINATION include/mysql COMPONENT headers)
+INSTALL(FILES libmysql/libmysql.def DESTINATION include COMPONENT headers)
+FILE(GLOB datafiles "${CMAKE_CURRENT_SOURCE_DIR}/win/data/mysql/*")
+INSTALL(FILES ${datafiles} DESTINATION data/mysql COMPONENT data)
+INSTALL(FILES win/data/maria_log.00000001 win/data/maria_log_control DESTINATION data COMPONENT data)
+INSTALL(DIRECTORY win/data/test DESTINATION data COMPONENT data)
+
+# Files in the share dir
+INSTALL(FILES sql/share/errmsg.txt DESTINATION share COMPONENT runtime)
+FILE(GLOB charsets sql/share/charsets/*)
+INSTALL(FILES ${charsets} DESTINATION share/charsets COMPONENT runtime)
+FILE(GLOB share_dirs sql/share/*)
+FOREACH(SUBDIR ${share_dirs})
+  FILE(RELATIVE_PATH DIRNAME ${PROJECT_SOURCE_DIR}/sql/share ${SUBDIR})
+  IF (EXISTS ${SUBDIR}/errmsg.sys)
+    INSTALL(FILES ${SUBDIR}/errmsg.sys DESTINATION share/${DIRNAME} COMPONENT runtime)
+  ENDIF(EXISTS ${SUBDIR}/errmsg.sys)
+ENDFOREACH(SUBDIR ${share_dirs})
+
+INCLUDE(InstallRequiredSystemLibraries)
+
+# This must always be the last line
+INCLUDE(CPack)

=== modified file 'client/CMakeLists.txt'
--- client/CMakeLists.txt	2009-09-04 05:54:16 +0000
+++ client/CMakeLists.txt	2010-05-06 13:30:55 +0000
@@ -83,3 +83,5 @@
   MYSQL_EMBED_MANIFEST("echo" "asInvoker")
 ENDIF(EMBED_MANIFESTS)
 
+INSTALL(TARGETS mysql mysqltest mysqlcheck mysqldump mysqlimport mysql_upgrade mysqlshow
+	mysqlbinlog mysqladmin mysqlslap echo DESTINATION bin COMPONENT runtime)

=== modified file 'extra/CMakeLists.txt'
--- extra/CMakeLists.txt	2009-05-15 12:57:51 +0000
+++ extra/CMakeLists.txt	2010-05-06 13:27:22 +0000
@@ -53,3 +53,5 @@
 IF(EMBED_MANIFESTS)
   MYSQL_EMBED_MANIFEST("myTest" "asInvoker")
 ENDIF(EMBED_MANIFESTS)
+
+INSTALL(TARGETS comp_err my_print_defaults perror resolveip replace DESTINATION bin COMPONENT runtime)

=== modified file 'libmysql/CMakeLists.txt'
--- libmysql/CMakeLists.txt	2009-09-15 10:46:35 +0000
+++ libmysql/CMakeLists.txt	2010-05-07 10:33:35 +0000
@@ -129,3 +129,11 @@
 IF(EMBED_MANIFESTS)
   MYSQL_EMBED_MANIFEST("myTest" "asInvoker")
 ENDIF(EMBED_MANIFESTS)
+
+# TODO: Install mysqlclient_notls?
+# TODO: Which component should these be part of, development?
+INSTALL(TARGETS mysqlclient DESTINATION lib/opt COMPONENT runtime)
+INSTALL(TARGETS libmysql DESTINATION lib/opt COMPONENT runtime)
+
+# Also install libmysql.dll to the bin dir
+INSTALL(TARGETS libmysql DESTINATION bin COMPONENT runtime)

=== modified file 'mysys/CMakeLists.txt'
--- mysys/CMakeLists.txt	2009-12-03 11:19:05 +0000
+++ mysys/CMakeLists.txt	2010-05-06 14:14:44 +0000
@@ -49,4 +49,6 @@
 
 IF(NOT SOURCE_SUBLIBS)
   ADD_LIBRARY(mysys ${MYSYS_SOURCES})
+  
+  INSTALL(TARGETS mysys DESTINATION lib/opt COMPONENT runtime) # TODO: Component?
 ENDIF(NOT SOURCE_SUBLIBS)

=== modified file 'regex/CMakeLists.txt'
--- regex/CMakeLists.txt	2009-10-09 07:53:29 +0000
+++ regex/CMakeLists.txt	2010-05-06 14:15:46 +0000
@@ -22,4 +22,6 @@
 
 IF(NOT SOURCE_SUBLIBS)
   ADD_LIBRARY(regex ${REGEX_SOURCES})
+  
+  INSTALL(TARGETS regex DESTINATION lib/opt COMPONENT runtime) # TODO: Component
 ENDIF(NOT SOURCE_SUBLIBS)

=== modified file 'scripts/CMakeLists.txt'
--- scripts/CMakeLists.txt	2008-03-11 14:46:07 +0000
+++ scripts/CMakeLists.txt	2010-05-06 14:42:04 +0000
@@ -75,3 +75,8 @@
 
 CONFIGURE_FILE(mysqlhotcopy.sh
                scripts/mysqlhotcopy.pl ESCAPE_QUOTES @ONLY)
+
+INSTALL(FILES scripts/mysqldumpslow.pl scripts/mysqlhotcopy.pl scripts/mysql_config.pl
+	scripts/mysql_convert_table_format.pl scripts/mysql_install_db.pl
+	scripts/mysql_secure_installation.pl scripts/mysqld_multi.pl
+	DESTINATION scripts COMPONENT perlscripts)

=== modified file 'server-tools/instance-manager/CMakeLists.txt'
--- server-tools/instance-manager/CMakeLists.txt	2007-12-27 17:16:02 +0000
+++ server-tools/instance-manager/CMakeLists.txt	2010-05-06 13:56:08 +0000
@@ -36,3 +36,5 @@
 IF(EMBED_MANIFESTS)
   MYSQL_EMBED_MANIFEST("mysqlmanager" "asInvoker")
 ENDIF(EMBED_MANIFESTS)
+
+INSTALL(TARGETS mysqlmanager DESTINATION bin COMPONENT runtime)

=== modified file 'sql/CMakeLists.txt'
--- sql/CMakeLists.txt	2010-01-29 18:42:22 +0000
+++ sql/CMakeLists.txt	2010-05-07 10:20:20 +0000
@@ -154,3 +154,8 @@
 ADD_LIBRARY(udf_example MODULE udf_example.c udf_example.def)
 ADD_DEPENDENCIES(udf_example strings GenError)
 TARGET_LINK_LIBRARIES(udf_example strings wsock32)
+
+INSTALL(TARGETS mysqld
+	RUNTIME DESTINATION bin COMPONENT runtime
+	LIBRARY DESTINATION lib COMPONENT runtime
+	ARCHIVE DESTINATION lib COMPONENT runtime)

=== modified file 'storage/maria/CMakeLists.txt'
--- storage/maria/CMakeLists.txt	2009-09-15 10:46:35 +0000
+++ storage/maria/CMakeLists.txt	2010-05-06 13:43:17 +0000
@@ -91,4 +91,7 @@
   MYSQL_EMBED_MANIFEST("maria_pack" "asInvoker")
 ENDIF(EMBED_MANIFESTS)
 
+INSTALL(TARGETS maria_ftdump maria_chk maria_read_log maria_pack maria_dump_log
+	DESTINATION bin COMPONENT runtime)
+
 ENDIF(NOT SOURCE_SUBLIBS)

=== modified file 'storage/myisam/CMakeLists.txt'
--- storage/myisam/CMakeLists.txt	2009-09-07 20:50:10 +0000
+++ storage/myisam/CMakeLists.txt	2010-05-06 13:50:07 +0000
@@ -70,4 +70,6 @@
     MYSQL_EMBED_MANIFEST("myisampack" "asInvoker")
   ENDIF(EMBED_MANIFESTS)
 
+  INSTALL(TARGETS myisam_ftdump myisamchk myisamlog myisampack DESTINATION bin COMPONENT runtime)
+
 ENDIF(NOT SOURCE_SUBLIBS)

=== modified file 'strings/CMakeLists.txt'
--- strings/CMakeLists.txt	2009-09-15 10:46:35 +0000
+++ strings/CMakeLists.txt	2010-05-06 14:18:18 +0000
@@ -30,4 +30,6 @@
 
 IF(NOT SOURCE_SUBLIBS)
   ADD_LIBRARY(strings ${STRINGS_SOURCES})
+  
+  INSTALL(TARGETS strings DESTINATION lib/opt COMPONENT runtime) # TODO: Component
 ENDIF(NOT SOURCE_SUBLIBS)

=== modified file 'tests/CMakeLists.txt'
--- tests/CMakeLists.txt	2008-05-22 22:25:21 +0000
+++ tests/CMakeLists.txt	2010-05-06 13:23:20 +0000
@@ -25,3 +25,5 @@
 
 ADD_EXECUTABLE(bug25714 bug25714.c)
 TARGET_LINK_LIBRARIES(bug25714 mysqlclient_notls wsock32)
+
+INSTALL(TARGETS mysql_client_test bug25714 DESTINATION bin COMPONENT runtime)

=== modified file 'zlib/CMakeLists.txt'
--- zlib/CMakeLists.txt	2007-08-03 20:57:21 +0000
+++ zlib/CMakeLists.txt	2010-05-06 14:18:42 +0000
@@ -27,4 +27,6 @@
 			zutil.c zutil.h)
 IF(NOT SOURCE_SUBLIBS)
   ADD_LIBRARY(zlib ${ZLIB_SOURCES})
+  
+  INSTALL(TARGETS zlib DESTINATION lib/opt COMPONENT runtime) # TODO: Component
 ENDIF(NOT SOURCE_SUBLIBS)


Follow ups