From: Lawrence S. <ljs...@us...> - 2020-09-19 22:32:30
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via a9d0ae1cc06071469ba8a40480d2ca7f5e2b73e2 (commit) via 458c0161b41913af4532d15a94aa0536e761a750 (commit) via 78966b55870b7568fff818aa257d96568fd399ff (commit) via 19a855c0043b744d950f9b4eebebf74f0634e94a (commit) via 690759f7404842536783d63516132e1a19276306 (commit) via 36461a5be228fb8b5b2495bceb51dd839dfad5a7 (commit) via 5994dfaaeb7298eaab53dc2d8d7ce5378981fe18 (commit) via 0b90f21f4ac5e081cd87c70aab272f961d00292b (commit) from a123aa1dead51102c947f28ce05078168779008f (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit a9d0ae1cc06071469ba8a40480d2ca7f5e2b73e2 Merge: 458c016 5994dfa Author: Lawrence Sebald <ljs...@us...> Date: Sat Sep 19 18:31:53 2020 -0400 Merge pull request #47 from mrneo240/genromfs_mingw Basic genromfs support for Windows (without Cygwin or WSL). commit 458c0161b41913af4532d15a94aa0536e761a750 Merge: a123aa1 78966b5 Author: Lawrence Sebald <ljs...@us...> Date: Sat Sep 19 18:28:54 2020 -0400 Merge pull request #48 from sizious/adventure-example-update Adventure example update commit 78966b55870b7568fff818aa257d96568fd399ff Merge: 19a855c a123aa1 Author: Lawrence Sebald <ljs...@us...> Date: Sat Sep 19 18:28:33 2020 -0400 Merge branch 'master' into adventure-example-update commit 19a855c0043b744d950f9b4eebebf74f0634e94a Author: SiZiOUS <si...@gm...> Date: Thu Sep 17 22:29:04 2020 +0200 Updating .gitignore commit 690759f7404842536783d63516132e1a19276306 Author: SiZiOUS <si...@gm...> Date: Thu Sep 17 22:01:50 2020 +0200 Fixing detection of MinGW.org vs. MinGW-w64 environments commit 36461a5be228fb8b5b2495bceb51dd839dfad5a7 Author: SiZiOUS <si...@gm...> Date: Thu Sep 17 21:15:07 2020 +0200 Updating adventure example for MinGW compatibility commit 5994dfaaeb7298eaab53dc2d8d7ce5378981fe18 Author: HaydenKow <819...@us...> Date: Mon Sep 14 16:09:50 2020 -0400 chore: clean warnings and missing includes commit 0b90f21f4ac5e081cd87c70aab272f961d00292b Author: HaydenKow <819...@us...> Date: Sun Sep 13 18:23:26 2020 -0400 feat: support basic version of genromfs on windows - no support for symlinks - basic romfs images only ----------------------------------------------------------------------- Summary of changes: .gitignore | 5 ++-- examples/dreamcast/conio/adventure/Makefile | 45 +++++++++++++++++++++-------- examples/dreamcast/conio/adventure/hdr.h | 24 +++++++++++++++ examples/dreamcast/conio/adventure/setup.c | 13 ++++++--- utils/genromfs/Makefile | 7 ++++- utils/genromfs/genromfs.c | 41 +++++++++++++++++++------- 6 files changed, 105 insertions(+), 30 deletions(-) diff --git a/.gitignore b/.gitignore index b2b6a4a..b7e6fb3 100644 --- a/.gitignore +++ b/.gitignore @@ -26,11 +26,13 @@ utils/gentexfont/gentexfont utils/isotest/isotest utils/makejitter/makejitter utils/dcbumpgen/dcbumpgen +utils/scramble/scramble +utils/makeip/makeip utils/naomibintool/naomibintool examples/dreamcast/basic/exec/romdisk/sub.bin examples/dreamcast/kgl/basic/vq/fruit.vq examples/dreamcast/conio/adventure/data.c -examples/dreamcast/conio/adventure/setup +examples/dreamcast/conio/adventure/datagen examples/dreamcast/png/romdisk_boot.img examples/dreamcast/pvr/modifier_volume_tex/romdisk/fruit.kmg examples/dreamcast/pvr/texture_render/texture_render.bin @@ -42,4 +44,3 @@ utils/dc-chain/gcc-* utils/dc-chain/newlib-* utils/dc-chain/gdb-* utils/dc-chain/insight-* -utils/scramble/scramble diff --git a/examples/dreamcast/conio/adventure/Makefile b/examples/dreamcast/conio/adventure/Makefile index eae1490..f192fc8 100644 --- a/examples/dreamcast/conio/adventure/Makefile +++ b/examples/dreamcast/conio/adventure/Makefile @@ -4,28 +4,49 @@ # (c)2002 Dan Potter # -all: rm-elf adventure.elf +# Program binary +TARGET = adventure.elf + +# Script data files +DATA_SOURCE = glorkz +DATA_TARGET = data.c + +# For MinGW/MSYS, MinGW-w64/MSYS2 and Cygwin +ifeq ($(shell echo $(OS)),Windows_NT) + EXECUTABLEEXTENSION := .exe +endif + +# Setup data utility processing +# Under Windows, avoid the "setup.exe" name as it causes problems with the UAC... +SETUP_SOURCE = setup.c +SETUP_TARGET = datagen$(EXECUTABLEEXTENSION) +SETUP_CFLAGS = -DSETUP + +# Additional configuration +HOST_CC = gcc + +all: rm-elf $(TARGET) include $(KOS_BASE)/Makefile.rules OBJS = porthelper.o crc.o done.o init.o io.o main.o save.o subr.o vocab.o wizard.o data.o -data.c: - gcc -o setup setup.c -DSETUP - ./setup glorkz > data.c +$(DATA_TARGET): + $(HOST_CC) -o $(SETUP_TARGET) $(SETUP_SOURCE) $(SETUP_CFLAGS) + ./$(SETUP_TARGET) $(DATA_SOURCE) > $(DATA_TARGET) clean: - -rm -f adventure.elf $(OBJS) data.c setup + -rm -f $(TARGET) $(OBJS) $(DATA_TARGET) $(SETUP_TARGET) rm-elf: - -rm -f adventure.elf + -rm -f $(TARGET) -adventure.elf: $(OBJS) - $(KOS_CC) $(KOS_CFLAGS) $(KOS_LDFLAGS) -o adventure.elf $(KOS_START) $(OBJS) $(DATAOBJS) $(OBJEXTRA) -lconio $(KOS_LIBS) +$(TARGET): $(OBJS) + $(KOS_CC) $(KOS_CFLAGS) $(KOS_LDFLAGS) -o $(TARGET) $(KOS_START) $(OBJS) $(DATAOBJS) $(OBJEXTRA) -lconio $(KOS_LIBS) -run: adventure.elf - $(KOS_LOADER) adventure.elf +run: $(TARGET) + $(KOS_LOADER) $(TARGET) dist: - -rm -f $(OBJS) data.c setup - $(KOS_STRIP) adventure.elf + -rm -f $(OBJS) $(DATA_TARGET) $(SETUP_TARGET) + $(KOS_STRIP) $(TARGET) diff --git a/examples/dreamcast/conio/adventure/hdr.h b/examples/dreamcast/conio/adventure/hdr.h index faadfd4..dc9839d 100644 --- a/examples/dreamcast/conio/adventure/hdr.h +++ b/examples/dreamcast/conio/adventure/hdr.h @@ -55,6 +55,30 @@ /* hdr.h: included by c advent files */ #ifdef SETUP + +/* Detect MinGW/MSYS vs. MinGW-w64/MSYS2 */ +#ifdef __MINGW32__ +#include <_mingw.h> +# ifdef __MINGW64_VERSION_MAJOR +# define __RT_MINGW_W64__ +# else +# define __RT_MINGW_ORG__ +# endif +#endif /* __MINGW32__ */ + +#ifdef __MINGW32__ +#ifdef __RT_MINGW_W64__ +/* MinGW-w64/MSYS2 */ +typedef unsigned long u_long; +#else +/* MinGW/MSYS */ +#define _BSD_SOURCE +#include <sys/bsdtypes.h> +#endif +#include <stdlib.h> +#define srandom srand +#endif /* __MINGW32__ */ + #include <sys/types.h> #include <signal.h> #else diff --git a/examples/dreamcast/conio/adventure/setup.c b/examples/dreamcast/conio/adventure/setup.c index cc56b75..5995845 100644 --- a/examples/dreamcast/conio/adventure/setup.c +++ b/examples/dreamcast/conio/adventure/setup.c @@ -66,7 +66,7 @@ static const char rcsid[] = /* #include <err.h> */ #include "hdr.h" /* SEED lives in there; keep them coordinated. */ -#define USAGE "Usage: setup file > data.c (file is typically glorkz)" +#define USAGE "Usage: setup file > data.c (file is typically glorkz)\n" #define YES 1 #define NO 0 @@ -78,10 +78,15 @@ main(int argc, char **argv) { FILE *infile; int c, count, linestart; - if(argc != 2) printf(USAGE); + if(argc != 2) { + printf(USAGE); + exit(2); + } - if((infile = fopen(argv[1], "r")) == NULL) - printf("Can't read file %s", argv[1]); + if((infile = fopen(argv[1], "r")) == NULL) { + printf("Can't read file %s\n", argv[1]); + exit(1); + } puts("/*\n * data.c: created by setup from the ascii data file."); puts(SIG1); diff --git a/utils/genromfs/Makefile b/utils/genromfs/Makefile index fd0725c..402901c 100644 --- a/utils/genromfs/Makefile +++ b/utils/genromfs/Makefile @@ -1,8 +1,13 @@ # Makefile for the genromfs program. +ifeq ($(OS), Windows_NT) + LDLIBS = -lshlwapi -lws2_32 +else +# Nothing +endif CFLAGS = -O2 -Wall #-g# -#LDFLAGS = -s -g +LDFLAGS = -s all: genromfs diff --git a/utils/genromfs/genromfs.c b/utils/genromfs/genromfs.c index 7f98906..a52b2e4 100644 --- a/utils/genromfs/genromfs.c +++ b/utils/genromfs/genromfs.c @@ -18,6 +18,8 @@ * 11 Jan 2001 special files of name @name,[cpub],major,minor * 21 Feb 2001 Cygwin build fixes * (Florian Schulze, Brian Peek) + * 13 Aug 2020 Mingw build fixes + * (Hayden Kowalchuk) */ /* @@ -67,26 +69,25 @@ #include <stdio.h> /* Userland pieces of the ANSI C standard I/O package */ #include <stdlib.h> /* Userland prototypes of the ANSI C std lib functions */ +#include <stdint.h> #include <string.h> /* Userland prototypes of the string handling funcs */ #include <unistd.h> /* Userland prototypes of the Unix std system calls */ #include <fcntl.h> /* Flag value for file handling functions */ #include <time.h> #if defined(_WIN32) && !defined(__CYGWIN__) # include <getopt.h> +# include <winsock2.h> +# include <shlwapi.h> +# define lstat stat #else +# include <sys/sysmacros.h> +# include <netinet/in.h> /* Consts & structs defined by the internet system */ # include <fnmatch.h> #endif /* _WIN32 */ #include <dirent.h> #include <sys/stat.h> #include <sys/types.h> - -#include <netinet/in.h> /* Consts & structs defined by the internet system */ - -/* good old times without autoconf... */ -#if defined(linux) || defined(sun) -#include <sys/sysmacros.h> -#endif - +#include <inttypes.h> struct romfh { int32_t nextfh; @@ -206,7 +207,11 @@ int nodematch(char *pattern, struct filenode *node) { /* XXX: ugly realbase is global */ if(pattern[0] == '/') start = node->realname + realbase; +#if defined(_WIN32) && !defined(__CYGWIN__) + return !PathMatchSpec(start, pattern); +#else return fnmatch(pattern, start, FNM_PATHNAME | FNM_PERIOD); +#endif } int findalign(struct filenode *node) { @@ -314,8 +319,8 @@ void dumpri(struct romfh *ri, struct filenode *n, FILE *f) { #if 0 fprintf(stderr, "RI: [at %06x] %08lx, %08lx, %08lx, %08lx [%s]\n", n->offset, - ntohl(ri->nextfh), ntohl(ri->spec), - ntohl(ri->size), ntohl(ri->checksum), + (long unsigned int)ntohl(ri->nextfh), (long unsigned int)ntohl(ri->spec), + (long unsigned int)ntohl(ri->size), (long unsigned int)ntohl(ri->checksum), n->name); #endif } @@ -358,6 +363,7 @@ int dumpnode(struct filenode *node, FILE *f) { dumpri(&ri, node, f); } +#if !defined(_WIN32) || defined(__CYGWIN__) else if(S_ISLNK(node->modes)) { ri.nextfh |= htonl(ROMFH_LNK); dumpri(&ri, node, f); @@ -367,6 +373,7 @@ int dumpnode(struct filenode *node, FILE *f) { } dumpdataa(bigbuf, node->size, f); } +#endif else if(S_ISREG(node->modes)) { int offset, len, fd, max, avail; ri.nextfh |= htonl(ROMFH_REG); @@ -404,6 +411,7 @@ int dumpnode(struct filenode *node, FILE *f) { offset += avail; } } +#if !defined(_WIN32) || defined(__CYGWIN__) else if(S_ISCHR(node->modes)) { ri.nextfh |= htonl(ROMFH_CHR); ri.spec = htonl(major(node->devnode) << 16 | minor(node->devnode)); @@ -422,6 +430,7 @@ int dumpnode(struct filenode *node, FILE *f) { ri.nextfh |= htonl(ROMFH_SCK); dumpri(&ri, node, f); } +#endif p = node->dirlist.head; @@ -547,7 +556,11 @@ struct filenode *findnode(struct filenode *node, dev_t dev, ino_t ino) { found = findnode(p, dev, ino); if(found) +#if defined(_WIN32) && !defined(__CYGWIN__) + return NULL; +#else return found; +#endif p = p->next; } @@ -638,6 +651,7 @@ int processdir(int level, const char *base, const char *dirname, struct stat *sb continue; } +#if !defined(_WIN32) || defined(__CYGWIN__) /* Handle special names */ if(n->name[0] == '@') { if(S_ISLNK(sb->st_mode)) { @@ -691,15 +705,18 @@ int processdir(int level, const char *base, const char *dirname, struct stat *sb } } } +#endif setnode(n, sb->st_dev, sb->st_ino, sb->st_mode); +#if !defined(_WIN32) || defined(__CYGWIN__) /* Skip unreadable files/dirs */ if(!S_ISLNK(n->modes) && access(n->realname, R_OK)) { fprintf(stderr, "ignoring '%s' (access failed)\n", n->realname); freenode(n); continue; } +#endif /* Look up old links */ if(strcmp(n->name, ".") == 0) { @@ -728,9 +745,11 @@ int processdir(int level, const char *base, const char *dirname, struct stat *sb else curroffset = alignnode(n, curroffset, 0); +#if !defined(_WIN32) || defined(__CYGWIN__) if(S_ISLNK(sb->st_mode)) { n->size = sb->st_size; } +#endif curroffset += spaceneeded(n); @@ -866,7 +885,7 @@ int main(int argc, char *argv[]) { } if(!volname) { - sprintf(buf, "rom %08lx", time(NULL)); + sprintf(buf, "rom %" PRId64, (int64_t)time(NULL)); volname = buf; } hooks/post-receive -- A pseudo Operating System for the Dreamcast. |