Skip to content

Commit 810c961

Browse files
committed
Added 64 bit build stuff
1 parent 030f44d commit 810c961

File tree

17 files changed

+627
-29
lines changed

17 files changed

+627
-29
lines changed

mta-mysql/build.sh

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#########################
2+
# Remove old binary
3+
#########################
4+
if [ -e "mta_mysql.so" ]; then
5+
rm mta_mysql.so
6+
fi
7+
8+
#########################
9+
# Prepare build
10+
#########################
11+
autoreconf -ifv
12+
./configure CXXFLAGS='-g -O2 -fPIC'
13+
make clean
14+
15+
#########################
16+
# Do build
17+
#########################
18+
echo Building...
19+
make >_make.log
20+
21+
#########################
22+
# Check for error
23+
#########################
24+
rc=$?
25+
if [ $rc -ne 0 ]; then
26+
echo "Stopping: make returned error code $rc"
27+
exit 1
28+
fi
29+
30+
#########################
31+
# Copy binary file
32+
#########################
33+
cp src/.libs/libmta_mysql.so ./mta_mysql.so
34+
echo "Build completed "`pwd`"/mta_mysql.so"
35+
exit 0

mta-mysql/include/common.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,22 @@ extern "C"
2929
#define MTAEXPORT extern "C"
3030
#endif
3131

32+
#if defined( _M_X64 ) || defined( __x86_64__ ) || defined( _M_AMD64 )
33+
#define ANY_x64
34+
#ifdef _WIN64
35+
#define WIN_x64
36+
#else
37+
#define LINUX_x64
38+
#endif
39+
#else
40+
#define ANY_x86
41+
#ifdef WIN32
42+
#define WIN_x86
43+
#else
44+
#define LINUX_x86
45+
#endif
46+
#endif
47+
3248
#include <list>
3349
#include <vector>
3450
// Obviously i can't get us this so other includes will most likely be needed later on

mta-mysql/lib/x64/libmysql.lib

25.7 KB
Binary file not shown.

mta-mysql/lib/x64/lua5.1.lib

25.4 KB
Binary file not shown.

mta-mysql/luaimports/luaimports.cpp

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -208,20 +208,24 @@ static void* pluaL_pushresult = 0;
208208
p ## x = dlsym(dl, #x); \
209209
if (p ## x == 0) \
210210
{ \
211-
pModuleManager->Printf("Unable to import " #x ": %s\n", dlerror()); \
212-
return; \
211+
pModuleManager->Printf("[mta-mysql] Unable to import " #x ": %s\n", dlerror()); \
212+
return false; \
213213
}
214214

215215
#ifdef __cplusplus
216216
extern "C"
217217
#endif
218-
void ImportLua()
218+
bool ImportLua()
219219
{
220+
#ifdef ANY_x64
221+
void* dl = dlopen("x64/deathmatch.so", RTLD_NOW | RTLD_NOLOAD);
222+
#else
220223
void* dl = dlopen("mods/deathmatch/deathmatch.so", RTLD_NOW | RTLD_NOLOAD);
224+
#endif
221225
if (!dl)
222226
{
223-
pModuleManager->Printf("Unable to open deathmatch.so: %s\n", dlerror());
224-
return;
227+
pModuleManager->ErrorPrintf("[mta-mysql] Unable to open deathmatch.so: %s\n", dlerror());
228+
return false;
225229
}
226230

227231
/*
@@ -386,6 +390,7 @@ void ImportLua()
386390
SAFE_IMPORT(luaL_addstring);
387391
SAFE_IMPORT(luaL_addvalue);
388392
SAFE_IMPORT(luaL_pushresult);
393+
return true;
389394
}
390395
#undef SAFE_IMPORT
391396

mta-mysql/luaimports/luaimports.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@
2929
*/
3030

3131
#if defined(_WIN32) || defined(_WIN64) || defined(__WIN32__) || defined(WIN32)
32-
#define ImportLua() while(0)
32+
#define ImportLua() true
3333
#else
3434
#ifdef __cplusplus
3535
extern "C"
3636
#endif
37-
void ImportLua();
37+
bool ImportLua();
3838
#endif

mta-mysql/mta_mysql.sln

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,19 @@ EndProject
55
Global
66
GlobalSection(SolutionConfigurationPlatforms) = preSolution
77
Debug|Win32 = Debug|Win32
8+
Debug|x64 = Debug|x64
89
Release|Win32 = Release|Win32
10+
Release|x64 = Release|x64
911
EndGlobalSection
1012
GlobalSection(ProjectConfigurationPlatforms) = postSolution
1113
{132A627F-058D-46F8-BCBB-63B6C8D2CC1A}.Debug|Win32.ActiveCfg = Debug|Win32
1214
{132A627F-058D-46F8-BCBB-63B6C8D2CC1A}.Debug|Win32.Build.0 = Debug|Win32
15+
{132A627F-058D-46F8-BCBB-63B6C8D2CC1A}.Debug|x64.ActiveCfg = Debug|x64
16+
{132A627F-058D-46F8-BCBB-63B6C8D2CC1A}.Debug|x64.Build.0 = Debug|x64
1317
{132A627F-058D-46F8-BCBB-63B6C8D2CC1A}.Release|Win32.ActiveCfg = Release|Win32
1418
{132A627F-058D-46F8-BCBB-63B6C8D2CC1A}.Release|Win32.Build.0 = Release|Win32
19+
{132A627F-058D-46F8-BCBB-63B6C8D2CC1A}.Release|x64.ActiveCfg = Release|x64
20+
{132A627F-058D-46F8-BCBB-63B6C8D2CC1A}.Release|x64.Build.0 = Release|x64
1521
EndGlobalSection
1622
GlobalSection(SolutionProperties) = preSolution
1723
HideSolutionNode = FALSE

0 commit comments

Comments
 (0)