Skip to content
Snippets Groups Projects
Commit d4dd866d authored by deuce's avatar deuce
Browse files

Support a static link of utilities on *nix(sbbs itself most likely can't be

linked statically, and even if it could, you probobly wouldn't want it to be)
Use gmake STATIC=1 to enable.
parent de05580e
Branches
Tags
No related merge requests found
......@@ -50,6 +50,7 @@
# DONT_CLOBBER_CC - Do not change the default setting of CC #
# OBJPATH_SUFFIX - Suffix appended to OBJPATH usefull for compiling #
# different options of the same source file #
# STATIC - Create a statically linked build if possible #
# #
# Common Build Macros Defined: #
# DELETE - Delete files (Preferrably verbose) #
......@@ -204,6 +205,11 @@ UL_SUF :=
OUTPUT := -o
LOUTPUT := -o
ifdef STATIC
LDFLAGS += -static
CFLAGS += -DSTATIC_LINK
endif
ifeq ($(os),openbsd)
SOFILE := $(SOFILE).$(VERSION)
else
......
CIOLIB-MT_LIBS += $(UL_PRE)ncurses$(UL_SUF)
ifndef NO_X
ifeq ($(os),linux)
CIOLIB-MT_LIBS += $(UL_PRE)dl$(UL_SUF)
endif
ifeq ($(os),sunos)
CIOLIB-MT_LIBS += $(UL_PRE)dl$(UL_SUF)
ifdef STATIC
CIOLIB-MT_LIBS += -lXlib
else
ifeq ($(os),linux)
CIOLIB-MT_LIBS += $(UL_PRE)dl$(UL_SUF)
endif
ifeq ($(os),sunos)
CIOLIB-MT_LIBS += $(UL_PRE)dl$(UL_SUF)
endif
endif
endif
......@@ -93,7 +93,9 @@
#include <sys/time.h>
#include <sys/types.h>
#ifndef STATIC_LINK
#include <dlfcn.h>
#endif
#include <fcntl.h>
#include <limits.h>
#include <paths.h>
......@@ -1286,6 +1288,34 @@ console_init()
if(dpy!=NULL)
return(0);
#ifdef STATIC_LINK
x11.XChangeGC=XChangeGC;
x11.XCopyPlane=XCopyPlane;
x11.XFillRectangle=XFillRectangle;
x11.XFlush=XFlush;
x11.XBell=XBell;
x11.XLookupString=XLookupString;
x11.XNextEvent=XNextEvent;
x11.XAllocSizeHints=XAllocSizeHints;
x11.XSetWMNormalHints=XSetWMNormalHints;
x11.XResizeWindow=XResizeWindow;
x11.XMapWindow=XMapWindow;
x11.XFree=XFree;
x11.XFreePixmap=XFreePixmap;
x11.XCreateBitmapFromData=XCreateBitmapFromData;
x11.XAllocColor=XAllocColor;
x11.XOpenDisplay=XOpenDisplay;
x11.XCreateSimpleWindow=XCreateSimpleWindow;
x11.XCreateGC=dlsym(dl,"XCreateGC");
x11.XSelectInput=XSelectInput;
x11.XStoreName=XStoreName;
x11.XGetSelectionOwner=XGetSelectionOwner;
x11.XConvertSelection=XConvertSelection;
x11.XGetWindowProperty=XGetWindowProperty;
x11.XChangeProperty=XChangeProperty;
x11.XSendEvent=XSendEvent;
x11.XSetSelectionOwner=XSetSelectionOwner;
#else
if((dl=dlopen("libX11.so",RTLD_LAZY))==NULL)
return(-1);
if((x11.XChangeGC=dlsym(dl,"XChangeGC"))==NULL) {
......@@ -1392,6 +1422,7 @@ console_init()
dlclose(dl);
return(-1);
}
#endif
sem_init(&console_mode_changed,0,0);
sem_init(&copybuf_set,0,0);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment