summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--appveyor.yml28
-rw-r--r--src/global.cc2
-rw-r--r--src/main.cc2
-rw-r--r--src/quotes.cc2
-rw-r--r--src/report.cc6
-rw-r--r--src/report.h3
-rw-r--r--src/select.cc4
-rw-r--r--src/stream.cc4
-rw-r--r--src/strptime.cc4
-rw-r--r--src/system.hh.in18
-rw-r--r--src/times.cc2
-rw-r--r--src/utils.cc4
-rw-r--r--src/utils.h2
-rw-r--r--test/unit/t_value.cc4
14 files changed, 59 insertions, 26 deletions
diff --git a/appveyor.yml b/appveyor.yml
new file mode 100644
index 00000000..c44dfeb3
--- /dev/null
+++ b/appveyor.yml
@@ -0,0 +1,28 @@
+version: build-{build}
+
+image: Visual Studio 2013
+
+shallow_clone: true # don't download repo history
+
+install:
+- time /t
+- tzutil /s "Eastern Standard Time_dstoff"
+- time /t
+
+build_script:
+- C:\msys64\usr\bin\bash -lc "pacman --noconfirm -Sy pacman"
+- C:\msys64\usr\bin\bash -lc "pacman --needed --noconfirm -Sy pacman-mirrors"
+- C:\msys64\usr\bin\bash -lc "pacman --needed --noconfirm -Syu"
+- C:\msys64\usr\bin\bash -lc "pacman --needed --noconfirm -S mingw-w64-i686-boost"
+- C:\msys64\usr\bin\bash -lc "pacman --needed --noconfirm -S mingw-w64-i686-mpfr"
+- C:\msys64\usr\bin\bash -lc "pacman --needed --noconfirm -S mingw-w64-i686-cmake"
+- C:\msys64\usr\bin\bash -lc "export PATH=/mingw32/bin:$PATH && cd $APPVEYOR_BUILD_FOLDER && cmake -G 'MSYS Makefiles'"
+- C:\msys64\usr\bin\bash -lc "export PATH=/mingw32/bin:$PATH && cd $APPVEYOR_BUILD_FOLDER && make -j2"
+
+after_build:
+- set LIB_DIR=C:\msys64\mingw32\bin
+- 7z a ledger-win.zip %APPVEYOR_BUILD_FOLDER%\ledger.exe %LIB_DIR%\libboost_filesystem-mt.dll %LIB_DIR%\libboost_regex-mt.dll %LIB_DIR%\libboost_system-mt.dll %LIB_DIR%\libgcc_s_dw2-1.dll %LIB_DIR%\libgmp-10.dll %LIB_DIR%\libicudt57.dll %LIB_DIR%\libicuuc57.dll %APPVEYOR_BUILD_FOLDER%\libledger.dll %LIB_DIR%\libstdc++-6.dll %LIB_DIR%\libwinpthread-1.dll
+
+artifacts:
+ - path: ledger-win.zip
+ name: Ledger Win32 binaries
diff --git a/src/global.cc b/src/global.cc
index 6edc69ca..a3f84409 100644
--- a/src/global.cc
+++ b/src/global.cc
@@ -451,7 +451,7 @@ expr_t::func_t global_scope_t::look_for_command(scope_t& scope,
void global_scope_t::visit_man_page() const
{
-#ifndef WIN32
+#ifndef _WIN32
int pid = fork();
if (pid < 0) {
throw std::logic_error(_("Failed to fork child process"));
diff --git a/src/main.cc b/src/main.cc
index 3a36280a..df1933f9 100644
--- a/src/main.cc
+++ b/src/main.cc
@@ -74,7 +74,7 @@ int main(int argc, char * argv[], char * envp[])
#endif
std::signal(SIGINT, sigint_handler);
-#ifndef WIN32
+#ifndef _WIN32
std::signal(SIGPIPE, sigpipe_handler);
#endif
diff --git a/src/quotes.cc b/src/quotes.cc
index 2777974e..0dd9c4ed 100644
--- a/src/quotes.cc
+++ b/src/quotes.cc
@@ -62,7 +62,7 @@ commodity_quote_from_script(commodity_t& commodity,
DEBUG("commodity.download", "invoking command: " << getquote_cmd);
bool success = true;
-#ifndef WIN32
+#ifndef _WIN32
if (FILE * fp = popen(getquote_cmd.c_str(), "r")) {
if (std::feof(fp) || ! std::fgets(buf, 255, fp))
success = false;
diff --git a/src/report.cc b/src/report.cc
index 9e480ea5..78ccac51 100644
--- a/src/report.cc
+++ b/src/report.cc
@@ -57,7 +57,7 @@ void report_t::normalize_options(const string& verb)
// Patch up some of the reporting options based on what kind of
// command it was.
-#if HAVE_ISATTY
+#ifdef HAVE_ISATTY
if (! HANDLED(force_color)) {
if (! HANDLED(no_color) && isatty(STDOUT_FILENO))
HANDLER(color).on("?normalize");
@@ -181,14 +181,14 @@ void report_t::normalize_options(const string& verb)
}
long cols = 0;
-#if HAVE_IOCTL
+#ifdef HAVE_IOCTL
struct winsize ws;
#endif
if (HANDLED(columns_))
cols = lexical_cast<long>(HANDLER(columns_).value);
else if (const char * columns = std::getenv("COLUMNS"))
cols = lexical_cast<long>(columns);
-#if HAVE_IOCTL
+#ifdef HAVE_IOCTL
else if (ioctl(STDIN_FILENO, TIOCGWINSZ, &ws) != -1)
cols = ws.ws_col;
#endif
diff --git a/src/report.h b/src/report.h
index 0873e64f..cdff13ae 100644
--- a/src/report.h
+++ b/src/report.h
@@ -793,7 +793,8 @@ public:
OPTION(report_t, output_); // -o
-#if HAVE_ISATTY
+// setenv() is not available on WIN32
+#if defined(HAVE_ISATTY) and !defined(_WIN32)
OPTION__
(report_t, pager_,
CTOR(report_t, pager_) {
diff --git a/src/select.cc b/src/select.cc
index 1c69b2bf..8e7786e6 100644
--- a/src/select.cc
+++ b/src/select.cc
@@ -145,14 +145,14 @@ value_t select_command(call_scope_t& args)
string thus_far = "";
std::size_t cols = 0;
-#if HAVE_IOCTL
+#ifdef HAVE_IOCTL
struct winsize ws;
#endif
if (report.HANDLED(columns_))
cols = lexical_cast<std::size_t>(report.HANDLER(columns_).value);
else if (const char * columns_env = std::getenv("COLUMNS"))
cols = lexical_cast<std::size_t>(columns_env);
-#if HAVE_IOCTL
+#ifdef HAVE_IOCTL
else if (ioctl(STDIN_FILENO, TIOCGWINSZ, &ws) != -1)
cols = ws.ws_col;
#endif
diff --git a/src/stream.cc b/src/stream.cc
index 60b0dc55..0c3ed995 100644
--- a/src/stream.cc
+++ b/src/stream.cc
@@ -58,7 +58,7 @@ namespace {
*/
int do_fork(std::ostream ** os, const path& pager_path)
{
-#ifndef WIN32
+#ifndef _WIN32
int pfd[2];
int status = pipe(pfd);
@@ -115,7 +115,7 @@ void output_stream_t::initialize(const optional<path>& output_file,
void output_stream_t::close()
{
-#ifndef WIN32
+#ifndef _WIN32
if (os != &std::cout) {
checked_delete(os);
os = &std::cout;
diff --git a/src/strptime.cc b/src/strptime.cc
index b31954f4..b9d485d2 100644
--- a/src/strptime.cc
+++ b/src/strptime.cc
@@ -13,7 +13,7 @@
// limitations under the License.
-#ifdef WIN32
+#ifdef _WIN32
// Implement strptime under windows
#include "strptime.h"
@@ -186,4 +186,4 @@ char* strptime(const char *buf, const char *fmt, struct tm *tm) {
return _strptime(buf, fmt, tm);
}
-#endif // WIN32
+#endif // _WIN32
diff --git a/src/system.hh.in b/src/system.hh.in
index 54bcf7a9..105436f6 100644
--- a/src/system.hh.in
+++ b/src/system.hh.in
@@ -60,12 +60,12 @@
#define HAVE_EDIT @HAVE_EDIT@
#define HAVE_GETTEXT @HAVE_GETTEXT@
-#define HAVE_ACCESS @HAVE_ACCESS@
-#define HAVE_REALPATH @HAVE_REALPATH@
-#define HAVE_GETPWUID @HAVE_GETPWUID@
-#define HAVE_GETPWNAM @HAVE_GETPWNAM@
-#define HAVE_IOCTL @HAVE_IOCTL@
-#define HAVE_ISATTY @HAVE_ISATTY@
+#cmakedefine HAVE_ACCESS
+#cmakedefine HAVE_REALPATH
+#cmakedefine HAVE_GETPWUID
+#cmakedefine HAVE_GETPWNAM
+#cmakedefine HAVE_IOCTL
+#cmakedefine HAVE_ISATTY
#define HAVE_UNIX_PIPES @HAVE_UNIX_PIPES@
@@ -144,16 +144,16 @@ typedef std::ostream::pos_type ostream_pos_type;
#endif
#include <sys/stat.h>
-#if defined(WIN32)
+#if defined(_WIN32)
#include <io.h>
#else
#include <unistd.h>
#endif
-#if HAVE_GETPWUID || HAVE_GETPWNAM
+#if defined(HAVE_GETPWUID) || defined(HAVE_GETPWNAM)
#include <pwd.h>
#endif
-#if HAVE_IOCTL
+#ifdef HAVE_IOCTL
#include <sys/ioctl.h>
#endif
diff --git a/src/times.cc b/src/times.cc
index 274abc83..01b89848 100644
--- a/src/times.cc
+++ b/src/times.cc
@@ -33,7 +33,7 @@
#include "times.h"
-#ifdef WIN32
+#ifdef _WIN32
#include "strptime.h"
#endif
diff --git a/src/utils.cc b/src/utils.cc
index 947f2408..fca9e6d4 100644
--- a/src/utils.cc
+++ b/src/utils.cc
@@ -807,7 +807,7 @@ path expand_path(const path& pathname)
if (path_string.length() == 1 || pos == 1) {
pfx = std::getenv("HOME");
-#if HAVE_GETPWUID
+#ifdef HAVE_GETPWUID
if (! pfx) {
// Punt. We're trying to expand ~/, but HOME isn't set
struct passwd * pw = getpwuid(getuid());
@@ -816,7 +816,7 @@ path expand_path(const path& pathname)
}
#endif
}
-#if HAVE_GETPWNAM
+#ifdef HAVE_GETPWNAM
else {
string user(path_string, 1, pos == string::npos ?
string::npos : pos - 1);
diff --git a/src/utils.h b/src/utils.h
index 42ea2ae9..d4a03a73 100644
--- a/src/utils.h
+++ b/src/utils.h
@@ -496,7 +496,7 @@ inline T& downcast(U& object) {
path resolve_path(const path& pathname);
-#if HAVE_REALPATH
+#ifdef HAVE_REALPATH
extern "C" char * realpath(const char *, char resolved_path[]);
#endif
diff --git a/test/unit/t_value.cc b/test/unit/t_value.cc
index 2daedcb1..398e075b 100644
--- a/test/unit/t_value.cc
+++ b/test/unit/t_value.cc
@@ -6,6 +6,10 @@
#include "value.h"
+#ifdef _WIN32
+#include "strptime.h"
+#endif
+
using namespace ledger;
struct value_fixture {