diff mbox

[v2] Enable building menuconfig on MinGW-w64/MSYS

Message ID CAOYw7dt_4iugqUUkEvO2tNpZT_pX_y+2kXYMRGpLc66Z21BztQ@mail.gmail.com
State Superseded
Headers show

Commit Message

Ray Donnelly Feb. 1, 2013, 11:20 p.m. UTC
changeset:   3177:a1d828096ac4
tag:         tip
user:        Ray Donnelly <mingw.android@gmail.com>
date:        Fri Feb 01 23:14:54 2013 +0000
files:       Makefile.in configure.ac kconfig/Makefile
kconfig/confdata.c kconfig/symbol.c
description:
Enable building menuconfig on MinGW-w64/MSYS



--
For unsubscribe information see http://sourceware.org/lists.html#faq

Comments

Yann E. MORIN Feb. 3, 2013, 10:08 a.m. UTC | #1
Ray, All,

Quoting Ray Donnelly <mingw.android@gmail.com>:
> changeset:   3177:a1d828096ac4
> tag:         tip
> user:        Ray Donnelly <mingw.android@gmail.com>
> date:        Fri Feb 01 23:14:54 2013 +0000
> files:       Makefile.in configure.ac kconfig/Makefile
> kconfig/confdata.c kconfig/symbol.c
> description:
> Enable building menuconfig on MinGW-w64/MSYS

I'm currently on the move (at FOSDEM), I'll look at this when
I'm back home (wednesday).

Anyway, you forgot to sign-off your patch. See:
    http://www.elinux.org/Developer_Certificate_Of_Origin

Please re-send with your Signed-off-by line.

Regards,
Yann E. MORIN.

--
For unsubscribe information see http://sourceware.org/lists.html#faq
diff mbox

Patch

diff -r 20f2459b97bf -r a1d828096ac4 Makefile.in
--- a/Makefile.in	Mon Jan 28 21:53:18 2013 +0100
+++ b/Makefile.in	Fri Feb 01 23:14:54 2013 +0000
@@ -71,6 +71,8 @@ 
 export LIBS            := @LIBS@
 export curses_hdr      := @ac_ct_curses_hdr@
 export gettext         := @gettext@
+export mkdir_one_arg   := @ac_cv_mkdir_takes_one_arg@
+export build_os        := @build_os@

 # config options to push down to kconfig
 KCONFIG:= @kconfig_options@
diff -r 20f2459b97bf -r a1d828096ac4 configure.ac
--- a/configure.ac	Mon Jan 28 21:53:18 2013 +0100
+++ b/configure.ac	Fri Feb 01 23:14:54 2013 +0000
@@ -82,6 +82,7 @@ 
 # ... but refuse --target
 AS_IF([test -n "$target_alias"],
       AC_MSG_ERROR([--target is not allowed]))
+AC_SUBST([build_os])

 # Allow program name tranformation (--program-{prefix,suffix,transform-name})
 AC_ARG_PROGRAM
@@ -370,6 +371,22 @@ 
     [sublibdir="/ct-ng.\${VERSION}"
      subdocdir="/ct-ng.\${VERSION}"])

+#----------------------------------------
+# Check whether mkdir takes one argument
+AC_SUBST([ac_cv_mkdir_takes_one_arg])
+AC_CACHE_VAL([ac_cv_mkdir_takes_one_arg],
+    [AC_CHECK_FUNCS([mkdir _mkdir])
+        AC_CACHE_CHECK([whether mkdir takes one argument],
+                       [ac_cv_mkdir_takes_one_arg],
+    [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+#include <sys/stat.h>
+#if HAVE_UNISTD_H
+#  include <unistd.h>
+#endif
+        ]],
+        [[mkdir (".");]])],
+        [ac_cv_mkdir_takes_one_arg=yes],[ac_cv_mkdir_takes_one_arg=no])])])
+
 #--------------------------------------------------------------------
 # Finally, generate the output file(s)
 #--------------------------------------------------------------------
diff -r 20f2459b97bf -r a1d828096ac4 kconfig/Makefile
--- a/kconfig/Makefile	Mon Jan 28 21:53:18 2013 +0100
+++ b/kconfig/Makefile	Fri Feb 01 23:14:54 2013 +0000
@@ -7,6 +7,15 @@ 

 # Build flags
 CFLAGS = -DCONFIG_=\"CT_\" -DPACKAGE="\"crosstool-NG $(VERSION)\""
+
+ifeq ($(mkdir_one_arg),yes)
+CFLAGS += -DMKDIR_TAKES_ONE_ARG
+endif
+
+ifeq ($(build_os),mingw32)
+MCONF_MINGW32_LDFLAGS = -lintl -lregex -liconv
+endif
+
 LDFLAGS =

 # Compiler flags to use gettext
@@ -41,7 +50,7 @@ 
 mconf_OBJ = $(patsubst %.c,%.o,$(mconf_SRC))
 mconf_DEP = $(patsubst %.c,%.dep,$(mconf_SRC))
 $(mconf_OBJ) $(mconf_DEP): CFLAGS += $(NCURSES_CFLAGS) $(INTL_CFLAGS)
-mconf: LDFLAGS += $(NCURSES_LDFLAGS)
+mconf: LDFLAGS += $(NCURSES_LDFLAGS) $(MCONF_MINGW32_LDFLAGS)

 # What's needed to build 'nconf'
 nconf_SRC = nconf.c nconf.gui.c
diff -r 20f2459b97bf -r a1d828096ac4 kconfig/confdata.c
--- a/kconfig/confdata.c	Mon Jan 28 21:53:18 2013 +0100
+++ b/kconfig/confdata.c	Fri Feb 01 23:14:54 2013 +0000
@@ -16,6 +16,10 @@ 
 #define LKC_DIRECT_LINK
 #include "lkc.h"

+#ifdef MKDIR_TAKES_ONE_ARG
+#define mkdir(_n,_p) mkdir((_n))
+#endif
+
 static void conf_warning(const char *fmt, ...)
 	__attribute__ ((format (printf, 1, 2)));

diff -r 20f2459b97bf -r a1d828096ac4 kconfig/symbol.c
--- a/kconfig/symbol.c	Mon Jan 28 21:53:18 2013 +0100
+++ b/kconfig/symbol.c	Fri Feb 01 23:14:54 2013 +0000
@@ -7,7 +7,12 @@ 
 #include <stdlib.h>
 #include <string.h>
 #include <regex.h>
-#include <sys/utsname.h>
+#if defined(__MINGW32__)
+# define UTS_RELEASE "1.0.17(0.48/3/2)"
+#else
+# include <sys/utsname.h>
+# define UTS_RELEASE uts.release
+#endif

 #define LKC_DIRECT_LINK
 #include "lkc.h"
@@ -46,19 +51,23 @@ 
 void sym_init(void)
 {
 	struct symbol *sym;
+#ifndef __MINGW32__
 	struct utsname uts;
+#endif
 	static bool inited = false;

 	if (inited)
 		return;
 	inited = true;

-	uname(&uts);
+#ifndef __MINGW32__
+    uname(&uts);
+#endif

 	sym = sym_lookup("UNAME_RELEASE", 0);
 	sym->type = S_STRING;
 	sym->flags |= SYMBOL_AUTO;
-	sym_add_default(sym, uts.release);
+	sym_add_default(sym, UTS_RELEASE);
 }

 enum symbol_type sym_get_type(struct symbol *sym)