summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@dside.dyndns.org>2014-06-12 19:03:18 +0200
committerSuren A. Chilingaryan <csa@dside.dyndns.org>2014-06-12 19:03:18 +0200
commitf5c9a8080f0932335457fe5cb0dff38c2d491cb5 (patch)
tree26ec33246b846a54a6a52747519ca80c3c1000b7
parent89f93872d8e024c761cc55335518f7d48d414fdb (diff)
downloadlibrcc-f5c9a8080f0932335457fe5cb0dff38c2d491cb5.tar.gz
librcc-f5c9a8080f0932335457fe5cb0dff38c2d491cb5.tar.bz2
librcc-f5c9a8080f0932335457fe5cb0dff38c2d491cb5.tar.xz
librcc-f5c9a8080f0932335457fe5cb0dff38c2d491cb5.zip
Mingw compatibility fixes by trialuser
-rw-r--r--CMakeLists.txt10
-rw-r--r--src/CMakeLists.txt2
-rw-r--r--src/librcc.c8
-rw-r--r--src/rccconfig.c4
-rw-r--r--src/rccexternal.c4
-rw-r--r--src/rcchome.c5
-rw-r--r--src/rcclock.c8
-rw-r--r--src/rccxml.c4
8 files changed, 39 insertions, 6 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 01cc4ce..e4558d7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -8,8 +8,10 @@ if (WIN32)
SET(USR_FOLDER "C:/DEVEL/UNIX" CACHE PATH "Path to libraries and includes")
SET(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES};${USR_FOLDER}/include)
INCLUDE_DIRECTORIES(${USR_FOLDER}/include)
+ INCLUDE_DIRECTORIES(${CMAKE_INSTALL_PREFIX}/include)
+ INCLUDE_DIRECTORIES(${CMAKE_INSTALL_PREFIX}/include/libxml2)
- find_library(ZLIB_LIBRARY NAMES zlib PATHS ${USR_FOLDER} PATH_SUFFIXES "lib")
+ find_library(ZLIB_LIBRARY NAMES zlib z PATHS ${USR_FOLDER} PATH_SUFFIXES "lib")
if (NOT ZLIB_LIBRARY)
MESSAGE(FATAL_ERROR "Could not find zlib")
endif()
@@ -24,17 +26,17 @@ if (WIN32)
MESSAGE(FATAL_ERROR "Could not find iconv")
endif ()
- find_library(ENCA_LIBRARY NAMES libenca PATHS ${USR_FOLDER} PATH_SUFFIXES "lib")
+ find_library(ENCA_LIBRARY NAMES libenca PATHS ${USR_FOLDER} ${CMAKE_INSTALL_PREFIX} PATH_SUFFIXES "lib")
if (ENCA_LIBRARY)
SET(HAVE_ENCA TRUE)
endif()
- find_library(LIBRCD_LIBRARY NAMES rcd PATHS ${USR_FOLDER} PATH_SUFFIXES "lib")
+ find_library(LIBRCD_LIBRARY NAMES rcd PATHS ${USR_FOLDER} ${CMAKE_INSTALL_PREFIX} PATH_SUFFIXES "lib")
if (LIBRCD_LIBRARY)
SET(HAVE_RCD TRUE)
endif()
- find_library(WSOCK_LIBRARY NAMES wsock32)
+ find_library(WSOCK_LIBRARY NAMES wsock32 PATHS ${USR_FOLDER} PATH_SUFFIXES "lib")
if (NOT WSOCK_LIBRARY)
MESSAGE(FATAL_ERROR "Could not find wsock library")
endif()
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 7477fd9..8b49d55 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -66,5 +66,5 @@ SET(rcc_SRCS
${HEADERS}
)
-ADD_LIBRARY(rcc ${rcc_SRCS})
+ADD_LIBRARY(rcc SHARED ${rcc_SRCS})
TARGET_LINK_LIBRARIES(rcc ${LIBXML2_LIBRARY} ${ICONV_LIBRARY} ${ENCA_LIBRARY} ${LIBRCD_LIBRARY} ${ZLIB_LIBRARY} ${WSOCK_LIBRARY})
diff --git a/src/librcc.c b/src/librcc.c
index b11c2ee..0fb9211 100644
--- a/src/librcc.c
+++ b/src/librcc.c
@@ -347,10 +347,18 @@ int rccInitDb4(rcc_context ctx, const char *name, rcc_db4_flags flags) {
if (!dbname) return -1;
sprintf(dbname,"%s/.rcc/",rcc_home_dir);
+#ifdef _WIN32
+ mkdir(dbname);
+#else
mkdir(dbname, 00755);
+#endif
sprintf(dbname,"%s/.rcc/%s.db/",rcc_home_dir,name);
+#ifdef _WIN32
+ mkdir(dbname);
+#else
mkdir(dbname, 00755);
+#endif
ctx->db4ctx = rccDb4CreateContext(dbname, flags);
free(dbname);
diff --git a/src/rccconfig.c b/src/rccconfig.c
index 204d82f..3748bab 100644
--- a/src/rccconfig.c
+++ b/src/rccconfig.c
@@ -35,6 +35,10 @@ rcc_language_alias rcc_default_aliases[RCC_MAX_ALIASES + 1];
rcc_language_alias rcc_default_aliases_embeded[RCC_MAX_ALIASES + 1] = {
/* { "cs_SK", "sk" },
{ "ru_UA", "uk" },*/
+#ifdef _WIN32
+ { "Russian_Russia", "ru" },
+ { "Ukrainian_Ukraine", "uk" },
+#endif
{ NULL, NULL }
};
diff --git a/src/rccexternal.c b/src/rccexternal.c
index eba1f71..1441f24 100644
--- a/src/rccexternal.c
+++ b/src/rccexternal.c
@@ -70,6 +70,7 @@ static char *addr = NULL;
#endif /* HAVE_UNISTD_H */
int rccExternalInit() {
+#ifndef _WIN32 // WNOHANG is not defined
#ifdef HAVE_UNISTD_H
# ifdef HAVE_SIGNAL_H
struct sigaction act;
@@ -111,10 +112,12 @@ int rccExternalInit() {
}
# endif /* HAVE_SYS_STAT_H */
#endif /* HAVE_UNISTD_H */
+#endif /* _WIN32 */
_exit(1);
}
void rccExternalFree() {
+#ifndef _WIN32 // WNOHANG is not defined
#ifdef HAVE_UNISTD_H
int retry;
pid_t res;
@@ -135,6 +138,7 @@ void rccExternalFree() {
pid = (pid_t)-1;
if (addr) free(addr);
#endif /* HAVE_UNISTD_H */
+#endif /* _WIN32 */
}
#ifdef HAVE_SYS_SELECT_H
diff --git a/src/rcchome.c b/src/rcchome.c
index bf72df1..becbaac 100644
--- a/src/rcchome.c
+++ b/src/rcchome.c
@@ -49,8 +49,11 @@ void rccHomeSet() {
#ifdef HAVE_PWD_H
struct passwd *pw;
#endif /* HAVE_PWD_H */
-
+#ifdef _WIN32
+ tmp = getenv ("HOMEPATH");
+#else
tmp = getenv ("HOME");
+#endif
if (tmp) rcc_home_dir = strdup (tmp);
#ifdef HAVE_PWD_H
else {
diff --git a/src/rcclock.c b/src/rcclock.c
index e5dda52..b72fd9f 100644
--- a/src/rcclock.c
+++ b/src/rcclock.c
@@ -63,10 +63,18 @@ int rccLock() {
if (!stmp) return -1;
sprintf(stmp,"%s/.rcc/", rcc_home_dir);
+#ifdef _WIN32
+ mkdir(stmp);
+#else
mkdir(stmp, 00755);
+#endif
sprintf(stmp,"%s/.rcc/locks/", rcc_home_dir);
+#ifdef _WIN32
+ mkdir(stmp);
+#else
mkdir(stmp, 00700);
+#endif
sprintf(stmp,"%s/.rcc/locks/rcc.lock", rcc_home_dir);
diff --git a/src/rccxml.c b/src/rccxml.c
index 39992f2..e79067f 100644
--- a/src/rccxml.c
+++ b/src/rccxml.c
@@ -340,7 +340,11 @@ int rccSave(rcc_context ctx, const char *name) {
if (!config) return -1;
sprintf(config,"%s/.rcc/",rcc_home_dir);
+#ifdef _WIN32
+ mkdir(config);
+#else
mkdir(config, 00755);
+#endif
sprintf(config,"%s/.rcc/%s.xml",rcc_home_dir,name);
fd = open(config, O_CREAT|O_RDWR,00644);