Skip to content

Commit

Permalink
Bump MySQL to 5.7.44 on Windows too (#2232)
Browse files Browse the repository at this point in the history
* Bump MySQL to 5.7.44 on Windows

* Look for MYSQL57 environment variable instead of MYSQL55
  • Loading branch information
peace-maker authored Jan 6, 2025
1 parent a44cfe1 commit 74f1f8f
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 11 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
ARCH: x86,x86_64
DEPENDENCIES_FOLDER: dependencies
DEPENDENCIES_ROOT: ${{ github.workspace }}/dependencies
MYSQL_VERSION: '5.5'
MYSQL_VERSION: '5.7'
MMSOURCE_VERSION: '1.12'
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -69,7 +69,7 @@ jobs:
# Satisfy checkout-deps requirement for a "sourcemod" folder.
mkdir -p sourcemod
../sourcemod/tools/checkout-deps.sh -s ${{ join(fromJSON(env.SDKS)) }}
../sourcemod/tools/checkout-deps.sh -s ${{ join(fromJSON(env.SDKS)) }} -d
- name: Install Linux dependencies
if: startsWith(runner.os, 'Linux')
Expand Down
4 changes: 2 additions & 2 deletions AMBuildScript
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ class SMConfig(object):
self.mysql_root['x86'] = builder.options.mysql_path
else:
for i in range(10):
self.mysql_root['x86'] = ResolveEnvPath('MYSQL55', 'mysql-5.' + str(i))
self.mysql_root['x86'] = ResolveEnvPath('MYSQL57', 'mysql-5.' + str(i))
if self.mysql_root['x86']:
break
if not self.mysql_root['x86'] or not os.path.isdir(self.mysql_root['x86']):
Expand All @@ -158,7 +158,7 @@ class SMConfig(object):
self.mysql_root['x86_64'] = builder.options.mysql64_path
else:
for i in range(10):
self.mysql_root['x86_64'] = ResolveEnvPath('MYSQL55_64', 'mysql-5.' + str(i) + '-x86_64')
self.mysql_root['x86_64'] = ResolveEnvPath('MYSQL57_64', 'mysql-5.' + str(i) + '-x86_64')
if self.mysql_root['x86_64']:
break
if not self.mysql_root['x86_64'] or not os.path.isdir(self.mysql_root['x86_64']):
Expand Down
15 changes: 14 additions & 1 deletion extensions/mysql/AMBuilder
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ if SM.mysql_root:
binary.compiler.cxxflags += ['-fno-rtti']
elif binary.compiler.family == 'msvc':
binary.compiler.cxxflags += ['/GR-']
if builder.options.debug == '1':
binary.compiler.cflags += ['/MDd']
else:
binary.compiler.cflags += ['/MD']

if binary.compiler.target.platform == 'linux' or binary.compiler.target.platform == 'mac':
binary.compiler.postlink += [
Expand All @@ -25,8 +29,17 @@ if SM.mysql_root:
binary.compiler.postlink += ['-lrt']
elif binary.compiler.target.platform == 'windows':
binary.compiler.defines += ['WIN32_LEAN_AND_MEAN']
if builder.options.debug == '1':
binary.compiler.defines += ['_ITERATOR_DEBUG_LEVEL=2']
binary.compiler.postlink += [
os.path.join(SM.mysql_root[arch], 'lib', 'debug', 'mysqlclient.lib'),
]
else:
binary.compiler.postlink += [
os.path.join(SM.mysql_root[arch], 'lib', 'mysqlclient.lib'),
]
binary.compiler.postlink += [
os.path.join(SM.mysql_root[arch], 'lib', 'mysqlclient.lib'),
'crypt32.lib',
'wsock32.lib'
]

Expand Down
35 changes: 29 additions & 6 deletions tools/checkout-deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,22 @@
trap "exit" INT

download_mysql=1
download_mysql_debug=1

# List of HL2SDK branch names to download.
# ./checkout-deps.sh -s tf2,css
# Disable downloading of mysql libraries.
# ./checkout-deps.sh -m
# Disable downloading of mysql debug libraries on Windows.
# ./checkout-deps.sh -d
while getopts ":s:m" opt; do
case $opt in
s) IFS=', ' read -r -a sdks <<< "$OPTARG"
;;
m) download_mysql=0
;;
d) download_mysql_debug=0
;;
\?) echo "Invalid option -$OPTARG" >&2
;;
esac
Expand Down Expand Up @@ -59,13 +64,14 @@ getmysql ()
}

# 32-bit MySQL
mysqlfolder=mysql-5.5
mysqlfolder=mysql-5.7
if [ $ismac -eq 1 ]; then
mysqlfolder=mysql-5.5
mysqlver=mysql-5.5.28-osx10.5-x86
mysqlurl=https://cdn.mysql.com/archives/mysql-5.5/$mysqlver.$archive_ext
elif [ $iswin -eq 1 ]; then
mysqlver=mysql-5.5.62-win32
mysqlurl=https://cdn.mysql.com/archives/mysql-5.5/$mysqlver.$archive_ext
mysqlver=mysql-5.7.44-win32
mysqlurl=https://cdn.mysql.com/archives/mysql-5.7/$mysqlver.$archive_ext
# The folder in the zip archive does not contain the substring "-noinstall", so strip it
mysqlver=${mysqlver/-noinstall}
else
Expand All @@ -77,13 +83,14 @@ if [ $download_mysql -eq 1 ]; then
fi

# 64-bit MySQL
mysqlfolder=mysql-5.5-x86_64
mysqlfolder=mysql-5.7-x86_64
if [ $ismac -eq 1 ]; then
mysqlfolder=mysql-5.5-x86_64
mysqlver=mysql-5.5.28-osx10.5-x86_64
mysqlurl=https://cdn.mysql.com/archives/mysql-5.5/$mysqlver.$archive_ext
elif [ $iswin -eq 1 ]; then
mysqlver=mysql-5.5.62-winx64
mysqlurl=https://cdn.mysql.com/archives/mysql-5.5/$mysqlver.$archive_ext
mysqlver=mysql-5.7.44-winx64
mysqlurl=https://cdn.mysql.com/archives/mysql-5.7/$mysqlver.$archive_ext
else
mysqlver=mysql-5.7.44-linux-glibc2.12-x86_64
mysqlurl=https://cdn.mysql.com/archives/mysql-5.7/$mysqlver.$archive_ext
Expand All @@ -92,6 +99,22 @@ if [ $download_mysql -eq 1 ]; then
getmysql
fi

if [ $iswin -eq 1 && $download_mysql_debug -eq 1 ]; then
mysqlfolder=mysql-5.7-debug
mysqlver=mysql-5.7.44-win32
mysqlurl=https://cdn.mysql.com/archives/mysql-5.7/$mysqlver-debug-test.$archive_ext
getmysql
cp -r $mysqlfolder/lib/* mysql-5.7/lib
rm -rf $mysqlfolder

mysqlfolder=mysql-5.7-debug-x86_64
mysqlver=mysql-5.7.44-winx64
mysqlurl=https://cdn.mysql.com/archives/mysql-5.7/$mysqlver-debug-test.$archive_ext
getmysql
cp -r $mysqlfolder/lib/* mysql-5.7-x86_64/lib
rm -rf $mysqlfolder
fi

checkout ()
{
if [ ! -d "$name" ]; then
Expand Down

0 comments on commit 74f1f8f

Please sign in to comment.