Commit 50147984 authored by Vladislav Vaintroub's avatar Vladislav Vaintroub

Create MySQL data folder in %ProgramData% directory.

Note that a read only copy will still exist  in the ProgramFiles directory
(so it can be reused for other instances)
parent 45a616b9
......@@ -18,28 +18,47 @@ IF(NOT WIX_DIR)
RETURN()
ENDIF()
# extra.wxs.in needs DATADIR_MYSQL_FILES and DATADIR_PERFORMANCE_SCHEMA_FILES, i.e
# Wix-compatible file lists for ${builddir}\sql\data\{mysql,performance_schema}
FOREACH(dir mysql performance_schema)
FILE(GLOB files ${CMAKE_BINARY_DIR}/sql/data/${dir}/*)
SET(filelist)
FOREACH(f ${files})
FILE(TO_NATIVE_PATH "${f}" file_native_path)
GET_FILENAME_COMPONENT(file_name "${f}" NAME)
SET(filelist
"${filelist}
<File Id='${file_name}' Source='${file_native_path}'/>")
ENDFOREACH()
STRING(TOUPPER ${dir} DIR_UPPER)
SET(DATADIR_${DIR_UPPER}_FILES "${filelist}")
ENDFOREACH()
FIND_PROGRAM(HEAT_EXECUTABLE heat ${WIX_DIR})
FIND_PROGRAM(CANDLE_EXECUTABLE candle ${WIX_DIR})
FIND_PROGRAM(LIGHT_EXECUTABLE light ${WIX_DIR})
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/create_msi.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/create_msi.cmake
@ONLY)
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/extra.wxs.in
${CMAKE_CURRENT_BINARY_DIR}/extra.wxs
@ONLY@
@ONLY
)
IF(CMAKE_GENERATOR MATCHES "Visual Studio")
SET(CONFIG_PARAM "-DCMAKE_INSTALL_CONFIG_NAME=${CMAKE_CFG_INTDIR}")
ENDIF()
ADD_CUSTOM_TARGET(
MSI
COMMAND set VS_UNICODE_OUTPUT=
COMMAND ${CMAKE_COMMAND}
-DCPACK_WIX_CONFIG=${CMAKE_CURRENT_SOURCE_DIR}/CPackWixConfig.cmake
-DCPACK_WIX_EXTRA_SOURCE=${CMAKE_CURRENT_BINARY_DIR}/extra.wxs
-DCPACK_WIX_INCLUDE=${CMAKE_CURRENT_BINARY_DIR}/extra.wxs
${CONFIG_PARAM}
-P ${CMAKE_CURRENT_BINARY_DIR}/create_msi.cmake
)
......@@ -49,7 +68,7 @@ ADD_CUSTOM_TARGET(
COMMAND set VS_UNICODE_OUTPUT=
COMMAND ${CMAKE_COMMAND} -DESSENTIALS=1
-DCPACK_WIX_CONFIG=${CMAKE_CURRENT_SOURCE_DIR}/CPackWixConfig.cmake
-DCPACK_WIX_EXTRA_SOURCE=${CMAKE_CURRENT_BINARY_DIR}/extra.wxs
-DCPACK_WIX_INCLUDE=${CMAKE_CURRENT_BINARY_DIR}/extra.wxs
${CONFIG_PARAM}
-P ${CMAKE_CURRENT_BINARY_DIR}/create_msi.cmake
)
......
......@@ -274,21 +274,24 @@ FILE(APPEND directories.wxs "</DirectoryRef>\n")
FILE(READ directories.wxs CPACK_WIX_DIRECTORIES)
FILE(REMOVE directories.wxs)
FOREACH(src ${CPACK_WIX_INCLUDE})
SET(CPACK_WIX_INCLUDES
"${CPACK_WIX_INCLUDES}
<?include ${src}?>"
)
ENDFOREACH()
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/mysql_server.wxs.in
${CMAKE_CURRENT_BINARY_DIR}/mysql_server.wxs)
SET(WXS_FILES ${CMAKE_CURRENT_BINARY_DIR}/mysql_server.wxs ${CPACK_WIX_EXTRA_SOURCE})
SET(WIXOBJ_NATIVE_FILES)
SET(WXS_NATIVE_FILES)
FOREACH(f "${WXS_FILES}")
FILE(TO_NATIVE_PATH "${f}" f)
EXECUTE_PROCESS(COMMAND ${CANDLE_EXECUTABLE} ${f})
STRING(REPLACE ".wxs" ".wixobj" f "${f}")
LIST(APPEND WIXOBJ_NATIVE_FILES ${f})
ENDFOREACH()
FILE(REMOVE mysql_server.wixobj)
EXECUTE_PROCESS(
COMMAND ${CANDLE_EXECUTABLE} -ext WixUtilExtension mysql_server.wxs
)
EXECUTE_PROCESS(
COMMAND ${LIGHT_EXECUTABLE} -ext WixUIExtension ${WIXOBJ_NATIVE_FILES} -out ${CPACK_PACKAGE_FILE_NAME}.msi
COMMAND ${LIGHT_EXECUTABLE} -ext WixUIExtension -ext WixUtilExtension
mysql_server.wixobj -out ${CPACK_PACKAGE_FILE_NAME}.msi
)
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Fragment>
<DirectoryRef Id="INSTALLDIR">
<Component Id="RegKeys" Guid="*">
<RegistryKey
Id='MySQLKey'
Root='HKLM'
Key='SOFTWARE\MySQL AB\[ProductName]'
Action='createAndRemoveOnUninstall'>
<RegistryValue
Type='string'
Name='Location'
Value='[INSTALLDIR]'/>
<RegistryValue
Type="string"
Name="Version"
Value="[ProductVersion]"/>
<RegistryValue
Type="string"
Name="DataLocation"
Value="[DATADIR]"/>
</RegistryKey>
</Component>
</DirectoryRef>
<Feature
Id='RegKeys'
Display='hidden'
Level='1'>
<ComponentRef Id='RegKeys'/>
</Feature>
</Fragment>
</Wix>
\ No newline at end of file
<Include xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
<DirectoryRef Id='TARGETDIR'>
<Component Id="RegKeys" Guid="*">
<RegistryKey
Id='MySQLKey'
Root='HKLM'
Key='SOFTWARE\MySQL AB\[ProductName]'
Action='createAndRemoveOnUninstall'>
<RegistryValue
Type='string'
Name='Location'
Value='[INSTALLDIR]'/>
<RegistryValue
Type="string"
Name="Version"
Value="[ProductVersion]"/>
<RegistryValue
Type="string"
Name="DataLocation"
Value="[DATADIR]"/>
</RegistryKey>
</Component>
</DirectoryRef>
<Feature
Id='RegKeys'
Display='hidden'
Level='1'>
<ComponentRef Id='RegKeys'/>
</Feature>
<!-- Datafiles that installation will copy to CommonAppData (initial database)
They are declared Permanent and NeverOverwrite since it is user data -->
<DirectoryRef Id='TARGETDIR'>
<Directory Id="CommonAppDataFolder">
<Directory Id="datadir.mysql" Name="MySQL">
<Directory Id="datadir.mysql.mysqlserver"
Name="MySQL Server @MAJOR_VERSION@.@MINOR_VERSION@">
<Directory Id="DATADIR" Name=".">
<Component Id="component.datadir" Guid="d3491319-5dbc-4477-95f3-4f809ef1dd2d">
<CreateFolder>
<util:PermissionEx User="[LogonUser]" GenericAll="yes" />
</CreateFolder>
</Component>
<Directory Id="datadir.mysql.mysqlserver.data" Name="data">
<Directory Id="datadir.mysql.mysqlserver.data.mysql" Name="mysql">
<Component Id="component.datadir.mysql"
Guid="19ec0f1f-1a7f-424e-a788-b09346c0a709"
Permanent="yes" NeverOverwrite="yes">
@DATADIR_MYSQL_FILES@
</Component>
</Directory>
<Directory Id="datadir.mysql.mysqlserver.data.performance_schema"
Name="performance_schema">
<Component Id="component.datadir.performance_schema"
Guid="af2a6776-2655-431f-a748-9e9f4645acc3"
Permanent="yes" NeverOverwrite="yes">
@DATADIR_PERFORMANCE_SCHEMA_FILES@
</Component>
</Directory>
<Directory Id="datadir.mysql.mysqlserver.data.test" Name="test">
<Component Id="component.datadir.test" Guid="52fa9f0a-fcd1-420a-b2ac-95a8f70ad20a">
<CreateFolder/>
</Component>
</Directory>
</Directory>
</Directory>
</Directory>
</Directory>
</Directory>
</DirectoryRef>
<Feature Id="UserEditableDatafiles" Level='1' Display='hidden' ConfigurableDirectory="DATADIR">
<ComponentRef Id="component.datadir"/>
<ComponentRef Id="component.datadir.mysql"/>
<ComponentRef Id="component.datadir.performance_schema"/>
<ComponentRef Id="component.datadir.test"/>
</Feature>
</Include>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
<Product
Id="*"
UpgradeCode="49EB7A6A-1CEF-4A1E-9E89-B9A4993963E3"
......@@ -78,5 +79,8 @@
<!--CPACK_WIX_COMPONENTS_GROUPS -->
@CPACK_WIX_COMPONENT_GROUPS@
<!--CPACK_WIX_INCLUDES -->
@CPACK_WIX_INCLUDES@
</Product>
</Wix>
</Wix>
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment