Skip to content

Commit de4d1d0

Browse files
committed
Moving build to Ubuntu
1 parent f0fa4cb commit de4d1d0

File tree

6 files changed

+23
-13
lines changed

6 files changed

+23
-13
lines changed

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,8 +198,8 @@ FakesAssemblies/
198198

199199
lib2inpx-win32.7z
200200
lib2inpx-win64.7z
201-
lib2inpx-linux_i686.tar.xz
202-
lib2inpx-linux_x86_64.tar.xz
201+
lib2inpx-linux_i686-glibc_*.tar.xz
202+
lib2inpx-linux_x86_64-glibc_*.tar.xz
203203

204204
[Bb]in_win32
205205
[Bb]in_win64

.set-project-env

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
set_go_env

CMakeLists.txt

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,18 @@ if(CMAKE_CROSSCOMPILING OR WIN32)
3131
set(DEST_DIR "${PROJECT_SOURCE_DIR}/bin_win64")
3232
find_path(WINPTHREAD_DLL_DIR libwinpthread-1.dll)
3333
else()
34-
# cmake -G "MSYS Makefiles" -DCMAKE_BUILD_TYPE=Release ..
3534
message(FATAL_ERROR "Currently unsuppored environment. CMake willl exit now.")
3635
endif()
36+
# When cross-compiling on Ubuntu libwinpthreadi.dll is not needed
37+
string(COMPARE EQUAL "WINPTHREAD_DLL_DIR-NOTFOUND" WINPTHREAD_DLL_DIR WINPTHREAD_DLL_FOUND)
3738
# I want static libraries everywhere (but for MySQL on Windows)
3839
set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_SHARED_LIBRARY_SUFFIX}.a)
3940
else()
4041
execute_process(COMMAND ${CMAKE_COMMAND} -E env uname -m OUTPUT_VARIABLE LINUX_BIN OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET)
4142
set(DEST_DIR "${PROJECT_SOURCE_DIR}/bin_linux_${LINUX_BIN}")
4243
set(CMAKE_FIND_LIBRARY_SUFFIXES .a)
4344
endif()
44-
message(STATUS "Destination directory: ${DEST_DIR} ${WINPTHREAD_DLL_DIR}")
45+
message(STATUS "Destination directory: ${DEST_DIR}")
4546

4647
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
4748
set(BUILD_SHARED_LIBS OFF)
@@ -106,14 +107,18 @@ FILE(GLOB scripts "scripts/*")
106107
install(PROGRAMS ${scripts} DESTINATION ${DEST_DIR} CONFIGURATIONS Release)
107108
if(CMAKE_CROSSCOMPILING OR WIN32)
108109
install(PROGRAMS ${MYSQL_LIB_DIR}/${MYSQL_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX} DESTINATION ${DEST_DIR} CONFIGURATIONS Release)
109-
install(PROGRAMS ${WINPTHREAD_DLL_DIR}/libwinpthread-1.dll DESTINATION ${DEST_DIR} CONFIGURATIONS Release)
110+
if(WINPTHREAD_DLL_FOUND)
111+
install(PROGRAMS ${WINPTHREAD_DLL_DIR}/libwinpthread-1.dll DESTINATION ${DEST_DIR} CONFIGURATIONS Release)
112+
endif()
110113
endif()
111114
install(FILES ${MYSQL_LIB_DIR}/../share/english/errmsg.sys DESTINATION ${DEST_DIR}/language CONFIGURATIONS Release)
112115
install(TARGETS lib2inpx DESTINATION ${DEST_DIR} CONFIGURATIONS Release)
113116
# for debugging purposes
114117
if(CMAKE_CROSSCOMPILING OR WIN32)
115118
install(PROGRAMS ${MYSQL_LIB_DIR}/${MYSQL_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX} DESTINATION ${PROJECT_BINARY_DIR} CONFIGURATIONS Release Debug)
116-
install(PROGRAMS ${WINPTHREAD_DLL_DIR}/libwinpthread-1.dll DESTINATION ${PROJECT_BINARY_DIR} CONFIGURATIONS Release Debug)
119+
if(WINPTHREAD_DLL_FOUND)
120+
install(PROGRAMS ${WINPTHREAD_DLL_DIR}/libwinpthread-1.dll DESTINATION ${PROJECT_BINARY_DIR} CONFIGURATIONS Release Debug)
121+
endif()
117122
endif()
118123
install(FILES ${MYSQL_LIB_DIR}/../share/english/errmsg.sys DESTINATION ${PROJECT_BINARY_DIR}/language CONFIGURATIONS Release Debug)
119124

build-release.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/bash -e
1+
#!env bash
22

33
# Standard preambule
44
plain() {
@@ -51,6 +51,7 @@ for _mingw in ${ARCH_INSTALLS}; do
5151
_gcc=x86_64-w64-mingw32-gcc
5252
;;
5353
linux)
54+
_glibc=`ldd --version | head -n 1 | awk '{ print $5; }'`
5455
_msystem=
5556
_os=$(uname)
5657
_arch=${_os,,}_$(uname -m)
@@ -84,7 +85,7 @@ for _mingw in ${ARCH_INSTALLS}; do
8485
if [ -z ${_msystem} ]; then
8586
[ -f lib2inpx-${_arch}.xz ] && rm lib2inpx-${_arch}.xz
8687

87-
tar --directory ${_dist} --create --xz --file lib2inpx-${_arch}.tar.xz .
88+
tar --directory ${_dist} --create --xz --file lib2inpx-${_arch}-glibc_${_glibc}.tar.xz .
8889
else
8990
[ -f lib2inpx-${_arch}.7z ] && rm lib2inpx-${_arch}.7z
9091

cmake/FindGo.cmake

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@
1111
# Example usage:
1212
# find_package(Go 1.2 REQUIRED)
1313

14-
15-
find_program(GO_EXECUTABLE go PATHS ENV GOROOT GOPATH PATH_SUFFIXES bin)
14+
find_program(GO_EXECUTABLE go PATHS ${HOME}/go ENV GOROOT GOPATH PATH_SUFFIXES bin)
1615
if(GO_EXECUTABLE)
1716
if(NOT CMAKE_CROSSCOMPILING AND WIN32 AND DEFINED ENV{MSYSTEM})
1817
if(NOT GO_ROOT)
@@ -25,9 +24,13 @@ if(GO_EXECUTABLE)
2524
endif()
2625
endif()
2726
else()
28-
set(GO_ROOT "/usr/lib/go")
27+
if (DEFINED ENV{GOROOT})
28+
set(GO_ROOT "$ENV{GOROOT}")
29+
else()
30+
set(GO_ROOT "/usr/lib/go")
31+
endif()
2932
endif()
30-
execute_process(COMMAND sh -c "GOROOT=${GO_ROOT} ${GO_EXECUTABLE} version" OUTPUT_VARIABLE GO_VERSION_OUTPUT OUTPUT_STRIP_TRAILING_WHITESPACE)
33+
execute_process(COMMAND sh -c "${GO_EXECUTABLE} version" OUTPUT_VARIABLE GO_VERSION_OUTPUT OUTPUT_STRIP_TRAILING_WHITESPACE)
3134
if(GO_VERSION_OUTPUT MATCHES "go([0-9]+\\.[0-9]+\\.?[0-9]*)[a-zA-Z0-9]* ([^/]+)/(.*)")
3235
set(GO_VERSION ${CMAKE_MATCH_1})
3336
set(GO_PLATFORM ${CMAKE_MATCH_2})

lib2inpx/lib2inpx.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1149,7 +1149,7 @@ int main(int argc, char* argv[])
11491149
#ifdef _WIN32
11501150
GetModuleFileName(NULL, module_path, sizeof module_path);
11511151
#else
1152-
readlink("/proc/self/exe", module_path, sizeof module_path);
1152+
ssize_t t = readlink("/proc/self/exe", module_path, sizeof module_path);
11531153
#endif
11541154

11551155
file_name = separate_file_name(module_path);

0 commit comments

Comments
 (0)