repair {Free,Open,Net}BSD build

Use OSSP UUID on {Free,Open}BSD and native UUID on NetBSD.

Building on OpenBSD requires a filesystem mounted with wxneeded.

original commit: e964d7d01a6d115e469c01626896b683d421d599
This commit is contained in:
Matthew Flatt 2019-06-11 07:02:51 -06:00
parent 6a8b48bd72
commit e8bd9b83cd
15 changed files with 78 additions and 15 deletions

View File

@ -35,7 +35,7 @@ ${Kernel}: ${kernelobj} ${zlibDep} ${LZ4Dep}
ld -r -X -o ${Kernel} ${kernelobj} ${zlibLib} ${LZ4Lib} ld -r -X -o ${Kernel} ${kernelobj} ${zlibLib} ${LZ4Lib}
${Scheme}: ${Kernel} ${Main} ${Scheme}: ${Kernel} ${Main}
$C -rdynamic -Wl,--export-dynamic -o ${Scheme} ${Kernel} ${Main} ${mdclib} ${LDFLAGS} $C -rdynamic -Wl,--export-dynamic -Wl,-zwxneeded -o ${Scheme} ${Kernel} ${Main} ${mdclib} ${LDFLAGS}
../zlib/configure.log: ../zlib/configure.log:
(cd ../zlib; CFLAGS="${CFLAGS} -m64" ./configure --64) (cd ../zlib; CFLAGS="${CFLAGS} -m64" ./configure --64)

View File

@ -17,7 +17,7 @@ m = i3ob
Cpu = I386 Cpu = I386
mdinclude = -I/usr/local/include -I/usr/X11R6/include mdinclude = -I/usr/local/include -I/usr/X11R6/include
mdclib = -L/usr/local/lib -liconv -lm $(LIBNCURSES) mdclib = -L/usr/local/lib -liconv -lm $(LIBNCURSES) -lossp-uuid
C = ${CC} ${CPPFLAGS} -Wpointer-arith -Werror -O ${CFLAGS} C = ${CC} ${CPPFLAGS} -Wpointer-arith -Werror -O ${CFLAGS}
o = o o = o
mdsrc = i3le.c mdsrc = i3le.c
@ -35,7 +35,7 @@ ${Kernel}: ${kernelobj} ${zlibDep} ${LZ4Dep}
ld -r -X -o ${Kernel} ${kernelobj} ${zlibLib} ${LZ4Lib} ld -r -X -o ${Kernel} ${kernelobj} ${zlibLib} ${LZ4Lib}
${Scheme}: ${Kernel} ${Main} ${Scheme}: ${Kernel} ${Main}
$C -rdynamic -Wl,--export-dynamic -o ${Scheme} ${Kernel} ${Main} ${mdclib} ${LDFLAGS} $C -rdynamic -Wl,--export-dynamic -Wl,-zwxneeded -o ${Scheme} ${Kernel} ${Main} ${mdclib} ${LDFLAGS}
../zlib/configure.log: ../zlib/configure.log:
(cd ../zlib; CFLAGS="${CFLAGS} -m32" ./configure) (cd ../zlib; CFLAGS="${CFLAGS} -m32" ./configure)

View File

@ -17,7 +17,7 @@ m = ta6fb
Cpu = X86_64 Cpu = X86_64
mdinclude = -I/usr/local/include -I/usr/X11R6/include mdinclude = -I/usr/local/include -I/usr/X11R6/include
mdclib = -L/usr/local/lib -liconv -lm $(LIBNCURSES) -lpthread mdclib = -L/usr/local/lib -liconv -lm $(LIBNCURSES) -lpthread -lossp-uuid
C = ${CC} ${CPPFLAGS} -Wpointer-arith -Wextra -Werror -O2 -D_REENTRANT -pthread ${CFLAGS} C = ${CC} ${CPPFLAGS} -Wpointer-arith -Wextra -Werror -O2 -D_REENTRANT -pthread ${CFLAGS}
o = o o = o
mdsrc = i3le.c mdsrc = i3le.c

View File

@ -36,6 +36,7 @@ ${Kernel}: ${kernelobj} ${zlibDep} ${LZ4Dep}
${Scheme}: ${Kernel} ${Main} ${Scheme}: ${Kernel} ${Main}
$C -rdynamic -o ${Scheme} ${Kernel} ${Main} ${mdclib} ${LDFLAGS} $C -rdynamic -o ${Scheme} ${Kernel} ${Main} ${mdclib} ${LDFLAGS}
paxctl +m ${Scheme}
../zlib/configure.log: ../zlib/configure.log:
(cd ../zlib; CFLAGS="${CFLAGS} -m64" ./configure --64) (cd ../zlib; CFLAGS="${CFLAGS} -m64" ./configure --64)

View File

@ -17,7 +17,7 @@ m = ta6ob
Cpu = X86_64 Cpu = X86_64
mdinclude = -I/usr/local/include -I/usr/X11R6/include mdinclude = -I/usr/local/include -I/usr/X11R6/include
mdclib = -L/usr/local/lib -liconv -lm $(LIBNCURSES) -lpthread mdclib = -L/usr/local/lib -liconv -lm $(LIBNCURSES) -lpthread -lossp-uuid
C = ${CC} ${CPPFLAGS} -Wpointer-arith -Werror -O2 -D_REENTRANT -pthread ${CFLAGS} C = ${CC} ${CPPFLAGS} -Wpointer-arith -Werror -O2 -D_REENTRANT -pthread ${CFLAGS}
o = o o = o
mdsrc = i3le.c mdsrc = i3le.c
@ -35,7 +35,7 @@ ${Kernel}: ${kernelobj} ${zlibDep} ${LZ4Dep}
ld -r -X -o ${Kernel} ${kernelobj} ${zlibLib} ${LZ4Lib} ld -r -X -o ${Kernel} ${kernelobj} ${zlibLib} ${LZ4Lib}
${Scheme}: ${Kernel} ${Main} ${Scheme}: ${Kernel} ${Main}
$C -rdynamic -Wl,--export-dynamic -o ${Scheme} ${Kernel} ${Main} ${mdclib} ${LDFLAGS} $C -rdynamic -Wl,--export-dynamic -Wl,-zwxneeded -o ${Scheme} ${Kernel} ${Main} ${mdclib} ${LDFLAGS}
../zlib/configure.log: ../zlib/configure.log:
(cd ../zlib; CFLAGS="${CFLAGS} -m64" ./configure --64) (cd ../zlib; CFLAGS="${CFLAGS} -m64" ./configure --64)

View File

@ -17,7 +17,7 @@ m = ti3fb
Cpu = I386 Cpu = I386
mdinclude = -I/usr/local/include -I/usr/X11R6/include mdinclude = -I/usr/local/include -I/usr/X11R6/include
mdclib = -L/usr/local/lib -liconv -lm $(LIBNCURSES) -lpthread mdclib = -L/usr/local/lib -liconv -lm $(LIBNCURSES) -lpthread -lossp-uuid
C = ${CC} ${CPPFLAGS} -Wpointer-arith -Wextra -Werror -O2 -D_REENTRANT -pthread ${CFLAGS} C = ${CC} ${CPPFLAGS} -Wpointer-arith -Wextra -Werror -O2 -D_REENTRANT -pthread ${CFLAGS}
o = o o = o
mdsrc = i3le.c mdsrc = i3le.c

View File

@ -17,7 +17,7 @@ m = ti3ob
Cpu = I386 Cpu = I386
mdinclude = -I/usr/local/include -I/usr/X11R6/include mdinclude = -I/usr/local/include -I/usr/X11R6/include
mdclib = -L/usr/local/lib -liconv -lm $(LIBNCURSES) -lpthread mdclib = -L/usr/local/lib -liconv -lm $(LIBNCURSES) -lpthread -lossp-uuid
C = ${CC} ${CPPFLAGS} -Wpointer-arith -Werror -O2 -D_REENTRANT -pthread ${CFLAGS} C = ${CC} ${CPPFLAGS} -Wpointer-arith -Werror -O2 -D_REENTRANT -pthread ${CFLAGS}
o = o o = o
mdsrc = i3le.c mdsrc = i3le.c
@ -35,7 +35,7 @@ ${Kernel}: ${kernelobj} ${zlibDep} ${LZ4Dep}
ld -r -X -o ${Kernel} ${kernelobj} ${zlibLib} ${LZ4Lib} ld -r -X -o ${Kernel} ${kernelobj} ${zlibLib} ${LZ4Lib}
${Scheme}: ${Kernel} ${Main} ${Scheme}: ${Kernel} ${Main}
$C -rdynamic -Wl,--export-dynamic -o ${Scheme} ${Kernel} ${Main} ${mdclib} ${LDFLAGS} $C -rdynamic -Wl,--export-dynamic -Wl,-zwxneeded -o ${Scheme} ${Kernel} ${Main} ${mdclib} ${LDFLAGS}
../zlib/configure.log: ../zlib/configure.log:
(cd ../zlib; CFLAGS="${CFLAGS} -m32" ./configure) (cd ../zlib; CFLAGS="${CFLAGS} -m32" ./configure)

View File

@ -549,7 +549,7 @@ static void s_ee_write_char(wchar_t c) {
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <wchar.h> #include <wchar.h>
#include <locale.h> #include <locale.h>
#ifndef __GLIBC__ #if !defined(__GLIBC__) && !defined(__OpenBSD__) && !defined(__NetBSD__)
#include <xlocale.h> #include <xlocale.h>
#endif #endif
@ -557,6 +557,17 @@ static void s_ee_write_char(wchar_t c) {
#define HANDLE_SIGWINCH #define HANDLE_SIGWINCH
#endif #endif
#ifdef USE_MBRTOWC_L
static locale_t the_locale;
static locale_t uselocale_alt(locale_t l) {
locale_t old = the_locale;
the_locale = l;
return old;
}
# define uselocale(v) uselocale_alt(v)
# define mbrtowc(pwc, s, n, ps) mbrtowc_l(pwc, s, n, ps, the_locale)
#endif
/* locally defined functions */ /* locally defined functions */
static int eeputc(tputsputcchar c); static int eeputc(tputsputcchar c);
#ifdef HANDLE_SIGWINCH #ifdef HANDLE_SIGWINCH

View File

@ -65,7 +65,50 @@ ptr S_unique_id() {
Sunsigned32(u.foo[3])))); Sunsigned32(u.foo[3]))));
} }
#else /* WIN32 */ #elif defined(USE_OSSP_UUID) /* WIN32 */
#include <ossp/uuid.h>
ptr S_unique_id() {
uuid_t *uuid;
U32 bin[4];
void *bin_ptr = &bin;
size_t bin_len = sizeof(bin);
uuid_create(&uuid);
uuid_make(uuid, UUID_MAKE_V4);
uuid_export(uuid, UUID_FMT_BIN, &bin_ptr, &bin_len);
uuid_destroy(uuid);
return S_add(S_ash(Sunsigned32(bin[0]), Sinteger(8*3*sizeof(U32))),
S_add(S_ash(Sunsigned32(bin[1]), Sinteger(8*2*sizeof(U32))),
S_add(S_ash(Sunsigned32(bin[2]), Sinteger(8*sizeof(U32))),
Sunsigned32(bin[3]))));
}
#elif defined(USE_NETBSD_UUID) /* USE_OSSP_UUID */
#include <uuid.h>
ptr S_unique_id() {
uuid_t uuid;
uint32_t status;
unsigned char bin[16];
ptr n;
unsigned int i;
uuid_create(&uuid, &status);
uuid_enc_le(bin, &uuid);
n = Sinteger(0);
for (i = 0; i < sizeof(bin); i++) {
n = S_add(n, S_ash(Sinteger(bin[i]), Sinteger(8*i)));
}
return n;
}
#else /* USE_NETBSD_UUID */
#include <uuid/uuid.h> #include <uuid/uuid.h>

View File

@ -434,6 +434,10 @@ IBOOL S_condition_wait(c, m, t) s_thread_cond_t *c; scheme_mutex_t *m; ptr t; {
typeno = Sinteger32_value(Srecord_ref(t,0)); typeno = Sinteger32_value(Srecord_ref(t,0));
sec = Sinteger32_value(Scar(Srecord_ref(t,1))); sec = Sinteger32_value(Scar(Srecord_ref(t,1)));
nsec = Sinteger32_value(Scdr(Srecord_ref(t,1))); nsec = Sinteger32_value(Scdr(Srecord_ref(t,1)));
} else {
typeno = 0;
sec = 0;
nsec = 0;
} }
if (c == &S_collect_cond || DISABLECOUNT(tc) == 0) { if (c == &S_collect_cond || DISABLECOUNT(tc) == 0) {

View File

@ -152,6 +152,7 @@ typedef int tputsputcchar;
#define NSECMTIME(sb) (sb).st_mtimespec.tv_nsec #define NSECMTIME(sb) (sb).st_mtimespec.tv_nsec
#define ICONV_INBUF_TYPE char ** #define ICONV_INBUF_TYPE char **
#define UNUSED __attribute__((__unused__)) #define UNUSED __attribute__((__unused__))
#define USE_OSSP_UUID
#endif #endif
#if (machine_type == machine_type_i3nb || machine_type == machine_type_ti3nb || machine_type == machine_type_a6nb || machine_type == machine_type_ta6nb) #if (machine_type == machine_type_i3nb || machine_type == machine_type_ti3nb || machine_type == machine_type_a6nb || machine_type == machine_type_ta6nb)
@ -185,6 +186,8 @@ typedef int tputsputcchar;
#define NSECMTIME(sb) (sb).st_mtimespec.tv_nsec #define NSECMTIME(sb) (sb).st_mtimespec.tv_nsec
#define ICONV_INBUF_TYPE const char ** #define ICONV_INBUF_TYPE const char **
#define UNUSED __attribute__((__unused__)) #define UNUSED __attribute__((__unused__))
#define USE_NETBSD_UUID
#define USE_MBRTOWC_L
#endif #endif
#if (machine_type == machine_type_i3nt || machine_type == machine_type_ti3nt || machine_type == machine_type_a6nt || machine_type == machine_type_ta6nt) #if (machine_type == machine_type_i3nt || machine_type == machine_type_ti3nt || machine_type == machine_type_a6nt || machine_type == machine_type_ta6nt)
@ -281,6 +284,7 @@ typedef int tputsputcchar;
#define NSECMTIME(sb) (sb).st_mtimespec.tv_nsec #define NSECMTIME(sb) (sb).st_mtimespec.tv_nsec
#define ICONV_INBUF_TYPE char ** #define ICONV_INBUF_TYPE char **
#define UNUSED __attribute__((__unused__)) #define UNUSED __attribute__((__unused__))
#define USE_OSSP_UUID
#endif #endif
#if (machine_type == machine_type_i3osx || machine_type == machine_type_ti3osx || machine_type == machine_type_a6osx || machine_type == machine_type_ta6osx) #if (machine_type == machine_type_i3osx || machine_type == machine_type_ti3osx || machine_type == machine_type_a6osx || machine_type == machine_type_ta6osx)

View File

@ -24,7 +24,7 @@
(define-constant size_t-bits 64) (define-constant size_t-bits 64)
(define-constant ptrdiff_t-bits 64) (define-constant ptrdiff_t-bits 64)
(define-constant wchar-bits 32) (define-constant wchar-bits 32)
(define-constant time-t-bits 32) (define-constant time-t-bits 64)
(define-constant max-float-alignment 8) (define-constant max-float-alignment 8)
(define-constant max-integer-alignment 8) (define-constant max-integer-alignment 8)
(define-constant asm-arg-reg-max 5) (define-constant asm-arg-reg-max 5)

View File

@ -24,7 +24,7 @@
(define-constant size_t-bits 64) (define-constant size_t-bits 64)
(define-constant ptrdiff_t-bits 64) (define-constant ptrdiff_t-bits 64)
(define-constant wchar-bits 32) (define-constant wchar-bits 32)
(define-constant time-t-bits 32) (define-constant time-t-bits 64)
(define-constant max-float-alignment 8) (define-constant max-float-alignment 8)
(define-constant max-integer-alignment 8) (define-constant max-integer-alignment 8)
(define-constant asm-arg-reg-max 5) (define-constant asm-arg-reg-max 5)

View File

@ -24,7 +24,7 @@
(define-constant size_t-bits 64) (define-constant size_t-bits 64)
(define-constant ptrdiff_t-bits 64) (define-constant ptrdiff_t-bits 64)
(define-constant wchar-bits 32) (define-constant wchar-bits 32)
(define-constant time-t-bits 32) (define-constant time-t-bits 64)
(define-constant max-float-alignment 8) (define-constant max-float-alignment 8)
(define-constant max-integer-alignment 8) (define-constant max-integer-alignment 8)
(define-constant asm-arg-reg-max 5) (define-constant asm-arg-reg-max 5)

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/bin/sh
if [ -d ../../.git ]; then if [ -d ../../.git ]; then
git describe --always --exclude='*' --abbrev=40 --dirty git describe --always --exclude='*' --abbrev=40 --dirty
echo 'git' echo 'git'