Patchwork Enable building menuconfig on MinGW-w64/MSYS

login
register
mail settings
Submitter Ray Donnelly
Date Feb. 1, 2013, 10:09 p.m.
Message ID <CAOYw7dvqWndrFUTixmJc2Q1s-ei6ebvK7zwPeXGNtaQTB=LeXg@mail.gmail.com>
Download mbox | patch
Permalink /patch/217602/
State Superseded
Headers show

Comments

Ray Donnelly - Feb. 1, 2013, 10:09 p.m.
changeset:   3177:94b01c98bd01
tag:         tip
user:        Ray Donnelly <mingw.android@gmail.com>
date:        Fri Feb 01 21:59:25 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

Patch

diff -r 20f2459b97bf -r 94b01c98bd01 Makefile.in
--- a/Makefile.in	Mon Jan 28 21:53:18 2013 +0100
+++ b/Makefile.in	Fri Feb 01 21:59:25 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 94b01c98bd01 configure.ac
--- a/configure.ac	Mon Jan 28 21:53:18 2013 +0100
+++ b/configure.ac	Fri Feb 01 21:59:25 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,21 @@ 
     [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_TRY_COMPILE([
+#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 94b01c98bd01 kconfig/Makefile
--- a/kconfig/Makefile	Mon Jan 28 21:53:18 2013 +0100
+++ b/kconfig/Makefile	Fri Feb 01 21:59:25 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 94b01c98bd01 kconfig/confdata.c
--- a/kconfig/confdata.c	Mon Jan 28 21:53:18 2013 +0100
+++ b/kconfig/confdata.c	Fri Feb 01 21:59:25 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 94b01c98bd01 kconfig/symbol.c
--- a/kconfig/symbol.c	Mon Jan 28 21:53:18 2013 +0100
+++ b/kconfig/symbol.c	Fri Feb 01 21:59:25 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)