Skip to content

Commit

Permalink
Allow compilation without non-free files
Browse files Browse the repository at this point in the history
This patch enables the compilation with a "OSI_COMPLIANT=YES" environment
variable. In this case, only Open Source files are used to build the
executables.
  • Loading branch information
olebole committed Jun 7, 2020
1 parent 854a624 commit e6d90b2
Show file tree
Hide file tree
Showing 11 changed files with 62 additions and 12,798 deletions.
9 changes: 6 additions & 3 deletions obm/Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
OBJS = Obm.o client.o param.o server.o widget.o gterm.o marker.o geom.o

# Non-free
OBJS += html.o

ALL_OBJS = ObmW/[A-Za-z]*.o $(OBJS)

CFLAGS += -I. -IObmW
Expand All @@ -13,6 +10,12 @@ ifeq ($(UNAME_S),Darwin)
LDFLAGS += -L/usr/X11/lib
endif

ifeq ($(OSI_COMPLIANT), YES)
CFLAGS += -DOSI_COMPLIANT
else
OBJS += html.o
endif

all: libobm.a

.PHONY: ObmW listres
Expand Down
13 changes: 12 additions & 1 deletion obm/ObmP.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@
#include <ObmW/Frame.h>
#include <ObmW/Group.h>
#include <ObmW/Gterm.h>
#ifndef OSI_COMPLIANT
#include <ObmW/HTML.h>
#endif
#include <ObmW/Icon.h>
#include <ObmW/Label.h>
#include <ObmW/Layout.h>
Expand All @@ -62,7 +64,9 @@
#include <ObmW/Toggle.h>

#include <X11/Xraw/Separator.h>
#ifndef OSI_COMPLIANT
#include <X11/Xraw/Table.h>
#endif

#include <X11/xpm.h>
#include <tcl/tcl.h>
Expand Down Expand Up @@ -115,7 +119,10 @@ typedef void (*ObmMethod)();

extern void ServerClassInit(), ClientClassInit(), ParameterClassInit();
extern void WidgetClassInit(), GenericClassDestroy();
extern void GtermClassInit(), MarkerClassInit(), HTMLClassInit();
extern void GtermClassInit(), MarkerClassInit();
#ifndef OSI_COMPLIANT
extern void HTMLClassInit();
#endif

/* Dummy WtClass bit flag definitions for initializers. */
#define WtServer 0, 0
Expand Down Expand Up @@ -272,8 +279,10 @@ objClassRec UiObjects[] = {
WidgetClassInit, NULL, NULL, NULL, NULL, NULL },
{ "StripChart", OtNonShell, &stripChartWidgetClass, WtStripChart,
WidgetClassInit, NULL, NULL, NULL, NULL, NULL },
#ifndef OSI_COMPLIANT
{ "Table", OtNonShell, &tableWidgetClass, WtTable,
WidgetClassInit, NULL, NULL, NULL, NULL, NULL },
#endif
{ "Tabs", OtNonShell, &tabsWidgetClass, WtTabs,
WidgetClassInit, NULL, NULL, NULL, NULL, NULL },
{ "Toggle", OtNonShell, &toggleWidgetClass, WtToggle,
Expand All @@ -289,8 +298,10 @@ objClassRec UiObjects[] = {
MarkerClassInit, NULL, NULL, NULL, NULL, NULL },
{ "Layout", OtNonShell, &layoutWidgetClass, WtLayout,
WidgetClassInit, NULL, NULL, NULL, NULL, NULL },
#ifndef OSI_COMPLIANT
{ "HTML", OtNonShell, &htmlWidgetClass, WtHTML,
HTMLClassInit, NULL, NULL, NULL, NULL, NULL },
#endif

{ "Arrow", OtNonShell, &xfwfArrowWidgetClass, WtArrow,
WidgetClassInit, NULL, NULL, NULL, NULL, NULL },
Expand Down
11 changes: 7 additions & 4 deletions obm/ObmW/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,20 @@ OBJS = Arrow.o Board.o Button.o Common.o DrawIString.o DrawString.o \
strnchr.o Tabs.o Gcs.o ListTree.o Separator.o Container.o color.o \
laygram.o laylex.o

# Non-free
OBJS += HTML-PSformat.o HTML.o HTMLformat.o HTMLimages.o HTMLjot.o \
HTMLlists.o HTMLparse.o HTMLwidgets.o Table.o Table3d.o TableUtil.o

CFLAGS += -I.
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Darwin)
CFLAGS += -I/usr/X11/include -D__DARWIN__
LDFLAGS += -L/usr/X11/lib
endif

ifeq ($(OSI_COMPLIANT), YES)
CFLAGS += -DOSI_COMPLIANT
else
OBJS += HTML-PSformat.o HTML.o HTMLformat.o HTMLimages.o HTMLjot.o \
HTMLlists.o HTMLparse.o HTMLwidgets.o Table.o Table3d.o TableUtil.o
endif

all: $(OBJS)

Gterm.o: Gterm.c GtermCnv.c GtermGraphics.c GtermImaging.c \
Expand Down
8 changes: 8 additions & 0 deletions obm/listres/AllWidgets.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ extern WidgetClass coreWidgetClass;
extern WidgetClass dialogWidgetClass;
extern WidgetClass formWidgetClass;
extern WidgetClass gripWidgetClass;
#ifndef OSI_COMPLIANT
extern WidgetClass htmlWidgetClass;
#endif
extern WidgetClass labelWidgetClass;
extern WidgetClass layoutWidgetClass;
extern WidgetClass listWidgetClass;
Expand Down Expand Up @@ -71,7 +73,9 @@ extern WidgetClass xfwfToggleWidgetClass;
extern WidgetClass tabsWidgetClass;
extern WidgetClass listtreeWidgetClass;
extern WidgetClass separatorWidgetClass;
#ifndef OSI_COMPLIANT
extern WidgetClass tableWidgetClass;
#endif
/*
extern WidgetClass scrolledTableWidgetClass;
*/
Expand Down Expand Up @@ -124,7 +128,9 @@ XmuWidgetNode XawWidgetArray[] = {
{ "arrow", &xfwfArrowWidgetClass },
{ "gterm", &gtermWidgetClass },
{ "layout", &layoutWidgetClass },
#ifndef OSI_COMPLIANT
{ "html", &htmlWidgetClass },
#endif
{ "board", &xfwfBoardWidgetClass },
{ "frame", &xfwfFrameWidgetClass },
{ "group", &xfwfGroupWidgetClass },
Expand All @@ -141,7 +147,9 @@ XmuWidgetNode XawWidgetArray[] = {
{ "listtree", &listtreeWidgetClass },
{ "tabs", &tabsWidgetClass },
{ "separator", &separatorWidgetClass },
#ifndef OSI_COMPLIANT
{ "table", &tableWidgetClass },
#endif
/*
{ "scrolledtable", &scrolledTableWidgetClass },
*/
Expand Down
7 changes: 6 additions & 1 deletion obm/widget.c
Original file line number Diff line number Diff line change
Expand Up @@ -230,10 +230,12 @@ static int widgetSetScrollbar(), widgetSetTTName(), widgetGetTTName();
static int widgetSetListTree(), widgetListTreeSelect();
static int widgetListTreeHighlight(), widgetListTreeDelete();
static int widgetSetLocation(), widgetSetCoordinates();
#ifndef OSI_COMPLIANT
static int widgetSetTable(), widgetSetCellAttr(), widgetGetCellAttr();
static int widgetGetColAttr(), widgetSetColAttr(), widgetSetRowAttr();
static int widgetDeleteRow(), widgetAddRow(), widgetGetTableSize();
static int widgetDeleteCol(), widgetAddCol(), widgetSetTableSize();
#endif
static int get_itemno(), buildTreeList(), widgetGetRowAttr();


Expand Down Expand Up @@ -341,6 +343,7 @@ register ObjClassRec classrec;
"listTreeHighlight", widgetListTreeHighlight,
(ClientData)msg, NULL);

#ifndef OSI_COMPLIANT
/* Table Widget Callbacks */
Tcl_CreateCommand (tcl,
"setTable", widgetSetTable, (ClientData)msg, NULL);
Expand Down Expand Up @@ -368,6 +371,7 @@ register ObjClassRec classrec;
"setTableSize", widgetSetTableSize, (ClientData)msg, NULL);
Tcl_CreateCommand (tcl,
"getTableSize", widgetGetTableSize, (ClientData)msg, NULL);
#endif

Tcl_CreateCommand (tcl,
"realize", widgetRealize, (ClientData)msg, NULL);
Expand Down Expand Up @@ -3279,6 +3283,7 @@ char **argv;
}


#ifndef OSI_COMPLIANT
/* widgetSetTable -- Set the contents of a Table widget.
*
* Usage: setTable nrows ncols data
Expand Down Expand Up @@ -3967,7 +3972,7 @@ char **argv;

return (TCL_OK);
}

#endif


/* widgetRealize -- Realize a widget. This activates and assigns windows for
Expand Down
16 changes: 15 additions & 1 deletion ximtool/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,20 @@ ifeq ($(UNAME_S),Darwin)
LDFLAGS += -L/usr/X11/lib
endif

ifeq ($(OSI_COMPLIANT), YES)
CFLAGS += -DOSI_COMPLIANT
else
ximclient.o: ximtool.html.h
endif

ximtool.o: ximtool.gui.h

ximtool.gui.h: ximtool.gui
sed -f gui2c.sed ximtool.gui > ximtool.gui.h

ximtool.html.h: ximtool.html
sed -f gui2c.sed ximtool.html > ximtool.html.h

ximtool: $(OBJS)
$(CC) $(LDFLAGS) -o $@ $(OBJS) \
-L../obm -lobm \
Expand All @@ -22,5 +36,5 @@ clients:
cd clients && mkpkg || true

clean:
rm -f ximtool $(OBJS)
rm -f ximtool ximtool.gui.h ximtool.html.h $(OBJS)
cd clients && mkpkg clean || true
2 changes: 2 additions & 0 deletions ximtool/ximclient.c
Original file line number Diff line number Diff line change
Expand Up @@ -2044,7 +2044,9 @@ char **argv;
/* The builtin default help text. */
static char *help_text[] = {
"setValue {",
#ifndef OSI_COMPLIANT
# include "ximtool.html.h"
#endif
"}",
NULL
};
Expand Down
4 changes: 4 additions & 0 deletions ximtool/ximtool.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ static char server[] = "server";
/* The builtin default GUI. */
char *defgui_text[] = {
# include "ximtool.gui.h"
#ifndef OSI_COMPLIANT
"send helpText addCallback anchorSelected anchor",
"send helpText addCallback testAnchor testAnchor",
#endif
NULL
};

Expand Down
4 changes: 2 additions & 2 deletions ximtool/ximtool.gui
Original file line number Diff line number Diff line change
Expand Up @@ -10174,13 +10174,13 @@ proc anchorSelected {widget cbtype event text href args} \
}
send helpText gotoId $anchID
send helpText retestAnchors
}; send helpText addCallback anchorSelected anchor
}

proc testAnchor {widget cbtype href} \
{
global visited
return [info exists visited($href)]
}; send helpText addCallback testAnchor testAnchor
}


# Callbacks to position forwards and backwards in link list.
Expand Down
Loading

0 comments on commit e6d90b2

Please sign in to comment.