Microwindows (nano-x)

Goran Gajic ggajic at afrodita.rcub.bg.ac.yu
Sat Feb 11 09:15:07 PST 2006



Hi,

Microwindows (www.microwindows.org) are nice mini X system.
They are not part of /usr/ports system but they can be usefull
for some small FreeBSD distributions like picoBSD or nanoBSD.
In order to cleanly compile (using src/Config/config.freebsd)
and run on FreeBSD (6.0 and 7.0-CURRENT) this is what has to be
changed to original microwindows-src-0.91 (I have contacted author of 
microwindows too) - but if someone needs it here it is.

Regards,
gg.

diff -ur microwindows-0.91/src/demos/nanox/Makefile microwindows-0.91/src/demos/nanox/Makefile
--- microwindows-0.91/src/demos/nanox/Makefile	Thu Sep 25 04:15:01 2003
+++ microwindows-0.91/src/demos/nanox/Makefile	Fri Feb 10 21:19:14 2006
@@ -26,6 +26,10 @@
  LDFLAGS +=
  LIBM = -lm

+ifeq ($(ARCH),FREEBSD-X86)
+LIBUTIL = -lutil
+endif
+
  ############################# targets section ################################

  ifeq ($(NANOX), Y)
@@ -70,7 +74,6 @@
  	$(MW_DIR_BIN)/nsaver \
  	$(MW_DIR_BIN)/nxcal \
  	$(MW_DIR_BIN)/grabdemo
-
  ifneq ($(ARCH),CYGWIN)
  TARGETS += \
  	$(MW_DIR_BIN)/nxterm
@@ -139,6 +142,12 @@
  	$(MW_DIR_BIN)/grabdemo \
  	$(MW_DIR_BIN)/nsaver

+ifeq ($(ARCH),FREEBSD-X86)
+# These demos need -lutil
+NANOX_DEMOS_WITH_LIBUTIL_LINK := \
+        $(MW_DIR_BIN)/nxterm 
+endif
+
  # These demos use a hardcoded link line.
  NANOX_DEMOS_WITH_NONSTANDARD_LINK := \
  	$(NANOX_DEMOS_WITH_LIBM_LINK) \
@@ -160,6 +169,13 @@
  	@echo "Linking $(patsubst $(MW_DIR_BIN)/%,%,$@) ..."
  	$(CC) $(CFLAGS) $(LDFLAGS) $< -o $@ $(LD_NANOXCLIENTLIBS) $(LIBM)

+ifeq ($(ARCH), FREEBSD-X86)
+# Link rule used for demos with libutil.
+$(NANOX_DEMOS_WITH_LIBUTIL_LINK):  $(MW_DIR_BIN)/%: $(MW_DIR_OBJ)/demos/nanox/%.o $(NANOXCLIENTLIBS) $(CONFIG)
+	@echo "Linking $(patsubst $(MW_DIR_BIN)/%,%,$@) ..."
+	$(CC) $(CFLAGS) $(LDFLAGS) $< -o $@ $(LD_NANOXCLIENTLIBS) $(LIBUTIL)
+endif 
+
  $(MW_DIR_BIN)/snap_jpg: $(MW_DIR_OBJ)/demos/nanox/snap_jpg.o $(NANOXCLIENTLIBS) $(CONFIG)
  	@echo "Linking $(patsubst $(MW_DIR_BIN)/%,%,$@) ..."
  	$(CC) $(CFLAGS) $(LDFLAGS) $< -o $@ $(LD_NANOXCLIENTLIBS) $(LIBJPEG)
diff -ur microwindows-0.91/src/demos/nxscribble/li_recognizer.c microwindows-0.91/src/demos/nxscribble/li_recognizer.c
--- microwindows-0.91/src/demos/nxscribble/li_recognizer.c	Sun Nov 16 23:34:12 2003
+++ microwindows-0.91/src/demos/nxscribble/li_recognizer.c	Fri Feb 10 20:27:39 2006
@@ -938,7 +938,7 @@
  ************************************************** */

  /*#include <assert.h>*/
-#if defined(__ECOS) || defined(__CYGWIN__)
+#if defined(__ECOS) || defined(__CYGWIN__) || defined (__FreeBSD__)
  #define MAXINT 0x7FFFFFFF
  #else
  #include <values.h>
diff -ur microwindows-0.91/src/demos/tuxchess/Makefile microwindows-0.91/src/demos/tuxchess/Makefile
--- microwindows-0.91/src/demos/tuxchess/Makefile	Thu Sep 25 04:15:01 2003
+++ microwindows-0.91/src/demos/tuxchess/Makefile	Fri Feb 10 20:44:09 2006
@@ -58,13 +58,19 @@

  ######################## Tools targets section ###############################

+ifeq ($(ARCH), FREEBSD-X86)
+LCOMPAT= -lcompat
+else
+LCOMPAT =
+endif
+
  ifeq ($(SHAREDLIBS), Y)
  $(MW_DIR_BIN)/tuxchess: $(OBJS) $(NANOXCLIENTLIBS) $(CONFIG)
  	@echo "Linking $(patsubst $(MW_DIR_BIN)/%,%,$@) ..."
-	$(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) -o $@ $(CCNANOXCLIENTLIBS)
+	$(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) -o $@ $(CCNANOXCLIENTLIBS) $(LCOMPAT)
  else
  $(MW_DIR_BIN)/tuxchess: $(OBJS) $(NANOXCLIENTLIBS) $(CONFIG)
  	@echo "Linking $(patsubst $(MW_DIR_BIN)/%,%,$@) ..."
-	$(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) -o $@ $(NANOXCLIENTLIBS)
+	$(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) -o $@ $(NANOXCLIENTLIBS) $(LCOMPAT)
  endif

diff -ur microwindows-0.91/src/demos/tuxchess/main.c microwindows-0.91/src/demos/tuxchess/main.c
--- microwindows-0.91/src/demos/tuxchess/main.c	Tue May  6 08:18:38 2003
+++ microwindows-0.91/src/demos/tuxchess/main.c	Fri Feb 10 20:34:07 2006
@@ -7,6 +7,9 @@
  #include <stdlib.h>
  #include <string.h>
  #include <signal.h>
+#if defined(__FreeBSD__)
+#include <sys/types.h>
+#endif
  #include <sys/timeb.h>
  #include "defs.h"
  #include "data.h"
diff -ur microwindows-0.91/src/drivers/fb.c microwindows-0.91/src/drivers/fb.c
--- microwindows-0.91/src/drivers/fb.c	Fri Apr 11 08:32:06 2003
+++ microwindows-0.91/src/drivers/fb.c	Fri Feb 10 19:59:11 2006
@@ -29,7 +29,9 @@
  	extern SUBDRIVER fblinear16;
  	extern SUBDRIVER fblinear24;
  	extern SUBDRIVER fblinear32;
+#if !defined(__FreeBSD__)
  	extern SUBDRIVER fblinear32alpha;
+#endif
  #if FBVGA
  	extern SUBDRIVER vgaplan4;
  	extern SUBDRIVER memplan4;
@@ -66,8 +68,10 @@
  			break;
  		case 32:
  			if (psd->pixtype == MWPF_TRUECOLOR8888) {
+#if ! defined (__FreeBSD__)
  				driver = &fblinear32alpha;
  			} else {
+#endif
  				driver = &fblinear32;
  			}
  			break;
diff -ur microwindows-0.91/src/drivers/mou_fbsd.c microwindows-0.91/src/drivers/mou_fbsd.c
--- microwindows-0.91/src/drivers/mou_fbsd.c	Thu Jun 21 08:32:41 2001
+++ microwindows-0.91/src/drivers/mou_fbsd.c	Fri Feb 10 19:49:14 2006
@@ -5,8 +5,7 @@
  #include <fcntl.h>
  #include <errno.h>

-#include <machine/mouse.h>
-#include <machine/console.h>
+#include <sys/mouse.h>

  /* #include <vgl.h> */

diff -ur microwindows-0.91/src/drivers/scr_fbsd.c microwindows-0.91/src/drivers/scr_fbsd.c
--- microwindows-0.91/src/drivers/scr_fbsd.c	Thu Jun 21 08:32:41 2001
+++ microwindows-0.91/src/drivers/scr_fbsd.c	Fri Feb 10 19:48:40 2006
@@ -8,7 +8,9 @@
   */

  #include <stdio.h>
-#include <machine/console.h>
+#include <sys/fbio.h>
+#include <sys/consio.h>
+#include <sys/kbio.h>
  #include <vgl.h>
  #include <signal.h>
  #include <osreldate.h>
diff -ur microwindows-0.91/src/include/swap.h microwindows-0.91/src/include/swap.h
--- microwindows-0.91/src/include/swap.h	Sat Feb 28 18:07:36 2004
+++ microwindows-0.91/src/include/swap.h	Fri Feb 10 19:46:46 2006
@@ -76,24 +76,6 @@
  #elif defined(__FreeBSD__)

  # include <machine/endian.h>
-# if __BYTE_ORDER == __BIG_ENDIAN
-#  if !MW_CPU_BIG_ENDIAN
-#   error MW_CPU_BIG_ENDIAN and your OS disagree about your CPUs byte-order.  Did you forget to set BIGENDIAN in the config file?
-#  endif
-#  ifndef __byte_swap_word
-/* Either this isn't GCC or the implementation changed. */
-#   warning __byte_swap_word not defined in endian.h on FreeBSD.
-#  else
-#   undef wswap
-#   undef dwswap
-#   define wswap(x)	__byte_swap_word(x)
-#   define dwswap(x)	__byte_swap_long(x)
-#  endif /* ifndef __byte_swap_word*/
-# else
-#  if MW_CPU_BIG_ENDIAN
-#   error MW_CPU_BIG_ENDIAN and your OS disagree about your CPUs byte-order.  Did you accidentally set BIGENDIAN in the config file?
-#  endif
-# endif /* !__BYTE_ORDER == __BIG_ENDIAN*/

  /* ********************************************************************* */
  /* ECOS                                                                  */
Only in microwindows-0.91/src/lib: -lcompat
diff -ur microwindows-0.91/src/mwin/winlib/caret.c microwindows-0.91/src/mwin/winlib/caret.c
--- microwindows-0.91/src/mwin/winlib/caret.c	Thu Nov 15 23:49:26 2001
+++ microwindows-0.91/src/mwin/winlib/caret.c	Fri Feb 10 19:57:13 2006
@@ -8,7 +8,7 @@
  #include <stdio.h>
  #include <stdlib.h>
  #include <sys/time.h>
-#ifndef __ECOS
+#if ! (defined (__FreeBSD__) || defined (__ECOS))
  #include <malloc.h>
  #endif
  #include "windows.h"


More information about the freebsd-ports mailing list