From 167937d0e03e78649ca9ec3c4927d8cd9a750737 Mon Sep 17 00:00:00 2001 From: Emeric MARTINEAU <11473190+bubulemaster@users.noreply.github.com> Date: Sun, 21 Jul 2019 14:08:34 +0200 Subject: [PATCH 01/18] Update to SGDK 1.40 --- .travis.yml | 9 +- Dockerfile | 10 +- Makefile | 7 +- README.md | 24 +++- examples/3d_example/Makefile | 204 --------------------------- examples/3d_example_2/Makefile | 204 --------------------------- examples/3d_example_2/main.c | 94 ++++++------- pkg/DEBIAN/control | 2 +- sgdk/Makefile | 32 ++--- sgdk/files/Makefile.rescomp | 198 -------------------------- sgdk/files/Makefile.sgdk_lib | 69 +++++----- sgdk/files/makefile.vars | 46 ++++--- sgdk/files/sgdk.diff | 244 ++++----------------------------- 13 files changed, 181 insertions(+), 962 deletions(-) delete mode 100644 examples/3d_example/Makefile delete mode 100644 examples/3d_example_2/Makefile delete mode 100644 sgdk/files/Makefile.rescomp diff --git a/.travis.yml b/.travis.yml index ed09c6d..a8f6171 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,4 @@ -dist: trusty +dist: bionic language: c sudo: false branches: @@ -9,6 +9,9 @@ addons: apt: packages: - texinfo + - openjdk-8-jdk + - dos2unix + - g++ cache: directories: - build @@ -20,7 +23,7 @@ jobs: - make clean - stage: Setup toolchain script: - - make toolchain_clean + - make toolchain_clean - cd toolchain && make setup - stage: Build bintutils script: @@ -47,7 +50,7 @@ jobs: - make sgdk_samples - stage: release to github if: tag IS present - script: + script: - echo "Deploying to github..." - VER=$TRAVIS_TAG make release deploy: diff --git a/Dockerfile b/Dockerfile index ae8f258..86ade9e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,14 @@ -FROM ubuntu:14.04 +FROM ubuntu:18.04 WORKDIR /tmp -RUN apt-get update && apt-get install -y build-essential wget unzip unrar-free texinfo git && apt-get clean +RUN apt-get update && \ + apt-get install -y build-essential wget unzip unrar-free texinfo git openjdk-8-jdk dos2unix && \ + apt-get clean + +# To download gcc 6.3 with wget. We must provide a password with '@' in. +RUN echo ftp_user=anonymous > ~/.wgetrc +RUN echo ftp_password=dfdf@dfdf.com >> ~/.wgetrc RUN bash -c "git clone https://github.com/kubilus1/gendev.git && cd gendev && make && rm -rf /tmp/*" diff --git a/Makefile b/Makefile index 170554d..51781a9 100644 --- a/Makefile +++ b/Makefile @@ -38,10 +38,10 @@ toolchain_build: toolchain_clean: cd toolchain && $(MAKE) toolchain_clean -tools_build: +tools_build: cd tools && $(MAKE) tools_build -tools_clean: +tools_clean: cd tools && $(MAKE) tools_clean sgdk_samples: @@ -80,7 +80,7 @@ dist/gendev_$(VER)_all.deb: pkg_build cd dist && dpkg-deb -Zxz -z9 --build $(TOPDIR)/pkg_build . sgdk_build: - cd sgdk && GENDEV=$(BUILDDIR) $(MAKE) install + cd sgdk && GENDEV=$(BUILDDIR) $(MAKE) install sgdk_clean: - cd sgdk && $(MAKE) clean @@ -97,4 +97,3 @@ clean: tools_clean toolchain_clean sgdk_clean ######################################################### ######################################################### ######################################################### - diff --git a/README.md b/README.md index 9191da3..d5a7333 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,10 @@ BASIC INSTRUCTIONS The quickest way to get going would be to simply install one of the release packages for this project. Both a 'txz' and 'deb' package are provided. +To run SGDK or in our case, Gendev, you need following packages: + - texinfo + - openjdk-8-jdk + USAGE ===== @@ -54,9 +58,17 @@ TOOLCHAIN BUILDING The toolchain is now setup with Travis-CI for continuous integration. This should ease porting and allow better validation of incoming patches. -You may decide to build the full toolchain by making sure you have the texinfo -package installed, and then: - +You may decide to build the full toolchain by making sure you have the following +package installed: + - git + - build-essential + - texinfo + - curl + - wget + - unzip + - dos2unix + +and then: ``` $ cd gendev $ make @@ -85,7 +97,7 @@ maintain. I am attempting to: -1. Not necessarilly require building everything +1. Not necessarilly require building everything 2. Shorten the build time 3. Hook up with continuous integration tools 4. Reduce the footprint @@ -98,8 +110,8 @@ NOTES: * The 32x stuff is currently deprecated. I may create steps to build this toolchain again in the future. -* All testing is done on 64bit Ubuntu installations, specifically Zesty and - Trusty. Your mileage may vary with other distros. +* All testing is done on 64bit Ubuntu installations, specifically Bionic. + Your mileage may vary with other distros. * [FreeBSD instructions](doc/FreeBSD.md) * This project is still way too messy, and hopefully I have time to cleanup cruft bit by bit. diff --git a/examples/3d_example/Makefile b/examples/3d_example/Makefile deleted file mode 100644 index 98d0547..0000000 --- a/examples/3d_example/Makefile +++ /dev/null @@ -1,204 +0,0 @@ -GENDEV?=/opt/toolchains/gen/ -GCC_VER?=6.3.0 - -MAKE?=make -LIB?=lib -GENGCC_BIN=$(GENDEV)/bin -GENBIN=$(GENDEV)/bin - -CC = $(GENGCC_BIN)/m68k-elf-gcc -AS = $(GENGCC_BIN)/m68k-elf-as -AR = $(GENGCC_BIN)/m68k-elf-ar -LD = $(GENGCC_BIN)/m68k-elf-ld -RANLIB = $(GENGCC_BIN)/m68k-elf-ranlib -OBJC = $(GENGCC_BIN)/m68k-elf-objcopy -BINTOS = $(GENBIN)/bintos -RESCOMP= $(GENBIN)/rescomp -XGMTOOL= $(GENBIN)/xgmtool -PCMTORAW = $(GENBIN)/pcmtoraw -WAVTORAW = $(GENBIN)/wavtoraw -SIZEBND = $(GENBIN)/sizebnd -ASMZ80 = $(GENBIN)/zasm - -RM = rm -f -NM = nm -NM2WCH = nm2wch -MKISOFS = mkisofs - -SCD_LOADER = scd/LukeProjectCD - -OPTION = -INCS = -I. -I$(GENDEV)/m68k-elf/include -I$(GENDEV)/sgdk/inc -Isrc -Ires -I$(GENDEV)/sgdk/res -CCFLAGS = $(OPTION) -m68000 -Wall -O2 -c -fomit-frame-pointer -HWCCFLAGS = $(OPTION) -m68000 -Wall -O1 -c -fomit-frame-pointer -Z80FLAGS = -vb2 -ASFLAGS = -m68000 --register-prefix-optional -#LIBS = -L$(GENDEV)/m68k-elf/lib -L$(GENDEV)/m68k-elf/lib/gcc/m68k-elf/4.8.2 -L$(GENDEV)/m68k-elf/m68k-elf/lib -lmd -lc -lgcc -lnosys -lm -LIBS = -L$(GENDEV)/m68k-elf/lib -L$(GENDEV)/m68k-elf/lib/gcc/m68k-elf/* -L$(GENDEV)/m68k-elf/m68k-elf/lib -lmd -lnosys -LINKFLAGS = -T $(GENDEV)/sgdk/md.ld -Map=output.map -nostdlib -L$(GENDEV)/sgdk/lib -SCDLINKFLAGS = -T scd/mdcd.ld -nostdlib -ARCHIVES = $(GENDEV)/sgdk/lib/libmd.a - - -# Are we AMD64? -#LBITS := $(shell getconf LONG_BIT) -#ifeq ($(LBITS), 64) -#ARCHIVES += $(GENDEV)/m68k-elf/lib64/gcc/m68k-elf/$(GCC_VER)/libgcc.a -#else -#ARCHIVES += $(GENDEV)/m68k-elf/lib/gcc/m68k-elf/$(GCC_VER)/libgcc.a -#endif - -ARCHIVES += $(GENDEV)/$(LIB)/gcc/m68k-elf/$(GCC_VER)/libgcc.a - -RESOURCES= -BOOT_RESOURCES= - -BOOTSS=$(wildcard boot/*.s) -BOOTSS+=$(wildcard src/boot/*.s) -BOOT_RESOURCES+=$(BOOTSS:.s=.o) - -SCDBOOTSS=$(wildcard scd/*.s) -SCDBOOTSS+=$(wildcard src/scd/*.s) -SCDBOOT_RESOURCES=$(SCDBOOTSS:.s=.o) - -#BMPS=$(wildcard res/*.bmp) -#VGMS=$(wildcard res/*.vgm) -#RAWS=$(wildcard res/*.raw) -#PCMS=$(wildcard res/*.pcm) -#MVSS=$(wildcard res/*.mvs) -#TFDS=$(wildcard res/*.tfd) -#WAVS=$(wildcard res/*.wav) -RESS=$(wildcard res/*.res) -#WAVPCMS=$(wildcard res/*.wavpcm) -#BMPS+=$(wildcard *.bmp) -#VGMS+=$(wildcard *.vgm) -#RAWS+=$(wildcard *.raw) -#PCMS+=$(wildcard *.pcm) -#MVSS+=$(wildcard *.mvs) -#TFDS+=$(wildcard *.tfd) -#WAVS+=$(wildcard *.wav) -RESS+=$(wildcard *.res) -#WAVPCMS+=$(wildcard *.wavpcm) - -#RESOURCES+=$(BMPS:.bmp=.o) -#RESOURCES+=$(VGMS:.vgm=.o) -#RESOURCES+=$(RAWS:.raw=.o) -#RESOURCES+=$(PCMS:.pcm=.o) -#RESOURCES+=$(MVSS:.mvs=.o) -#RESOURCES+=$(TFDS:.tfd=.o) -#RESOURCES+=$(WAVS:.wav=.o) -#RESOURCES+=$(WAVPCMS:.wavpcm=.o) -RESOURCES+=$(RESS:.res=.o) - -CS=$(wildcard src/*.c) -SS=$(wildcard src/*.s) -S80S=$(wildcard src/*.s80) -CS+=$(wildcard *.c) -SS+=$(wildcard *.s) -S80S+=$(wildcard *.s80) -RESOURCES+=$(CS:.c=.o) -RESOURCES+=$(SS:.s=.o) -RESOURCES+=$(S80S:.s80=.o) - -OBJS = $(RESOURCES) - -all: out.bin - -boot/sega.o: boot/rom_head.bin - $(AS) $(ASFLAGS) boot/sega.s -o $@ - -scd/segacd.o: - $(AS) $(ASFLAGS) scd/segacd.s -o $@ - - -out.iso: out.elf_scd - # - # Create a sega cd image. Limited to 256K or smaller Roms - # - $(NM) -n -S -t x out.elf_scd > out.nm - $(OBJC) -O binary out.elf_scd out.bin - $(SIZEBND) out.bin -sizealign 131072 - $(OBJC) -O binary out.elf_scd $(SCD_LOADER)/_filesystem/M_INIT.PRG - $(SIZEBND) $(SCD_LOADER)/_filesystem/M_INIT.PRG -sizealign 131072 - $(MKISOFS) -iso-level 1 -o $(SCD_LOADER)/filesystem.img -pad $(SCD_LOADER)/_filesystem - tail -c +32769 $(SCD_LOADER)/filesystem.img > $(SCD_LOADER)/filesystem.bin - $(RM) -f $(SCD_LOADER)/filesystem.img - cd $(SCD_LOADER) && $(AS) $(ASFLAGS) -M -ahlsm=listing.asm main-us-as.asm -o out.iso - tail -c +53 $(SCD_LOADER)/out.iso > out.iso - $(RM) -f $(SCD_LOADER)/filesystem.bin - -%.bin: %.elf - $(OBJC) -O binary $< temp.bin - dd if=temp.bin of=$@ bs=8K conv=sync - -%.elf: $(OBJS) $(BOOT_RESOURCES) - $(LD) -o $@ $(LINKFLAGS) $(BOOT_RESOURCES) $(ARCHIVES) $(OBJS) $(LIBS) - -%.elf_scd: $(OBJS) $(SCDBOOT_RESOURCES) - $(LD) -o $@ $(SCDLINKFLAGS) $(SCDBOOT_RESOURCES) $(ARCHIVES) $(OBJS) $(LIBS) - -%.o80: %.s80 - $(ASMZ80) $(Z80FLAGS) -o $@ $< - -%.c: %.o80 - $(BINTOS) $< - -%.o: %.c - $(CC) $(CCFLAGS) $(INCS) -c $< -o $@ - -%.o: %.s - $(AS) $(ASFLAGS) $< -o $@ - -%.s: %.bmp - bintos -bmp $< - -%.rawpcm: %.pcm - $(PCMTORAW) $< $@ - -%.raw: %.wav - $(WAVTORAW) $< $@ 16000 - -%.pcm: %.wavpcm - $(WAVTORAW) $< $@ 22050 - -#%.tfc: %.tfd -# $(TFMCOM) $< - -#%.o80: %.s80 -# $(ASMZ80) $(FLAGSZ80) $< $@ out.lst - -%.s: %.tfd - $(BINTOS) -align 32768 $< - -%.s: %.mvs - $(BINTOS) -align 256 $< - -%.s: %.esf - $(BINTOS) -align 32768 $< - -%.s: %.eif - $(BINTOS) -align 256 $< - -%.s: %.vgm - $(BINTOS) -align 256 $< - -%.s: %.raw - $(BINTOS) -align 256 -sizealign 256 $< - -%.s: %.rawpcm - $(BINTOS) -align 128 -sizealign 128 -nullfill 136 $< - -%.s: %.rawpcm - $(BINTOS) -align 128 -sizealign 128 -nullfill 136 $< - -%.s: %.res - $(RESCOMP) $< $@ - -boot/rom_head.bin: boot/rom_head.o - $(LD) $(LINKFLAGS) --oformat binary -o $@ $< - - -clean: - $(RM) $(RESOURCES) - $(RM) *.o *.bin *.elf *.elf_scd *.map *.iso - $(RM) boot/*.o boot/*.bin diff --git a/examples/3d_example_2/Makefile b/examples/3d_example_2/Makefile deleted file mode 100644 index 3c3f601..0000000 --- a/examples/3d_example_2/Makefile +++ /dev/null @@ -1,204 +0,0 @@ -GENDEV?=/opt/toolchains/gen/ -GCC_VER?=4.8.2 - -MAKE?=make -LIB?=lib -GENGCC_BIN=$(GENDEV)/m68k-elf/bin -GENBIN=$(GENDEV)/bin - -CC = $(GENGCC_BIN)/m68k-elf-gcc -AS = $(GENGCC_BIN)/m68k-elf-as -AR = $(GENGCC_BIN)/m68k-elf-ar -LD = $(GENGCC_BIN)/m68k-elf-ld -RANLIB = $(GENGCC_BIN)/m68k-elf-ranlib -OBJC = $(GENGCC_BIN)/m68k-elf-objcopy -BINTOS = $(GENBIN)/bintos -RESCOMP= $(GENBIN)/rescomp -XGMTOOL= $(GENBIN)/xgmtool -PCMTORAW = $(GENBIN)/pcmtoraw -WAVTORAW = $(GENBIN)/wavtoraw -SIZEBND = $(GENBIN)/sizebnd -ASMZ80 = $(GENBIN)/zasm - -RM = rm -f -NM = nm -NM2WCH = nm2wch -MKISOFS = mkisofs - -SCD_LOADER = scd/LukeProjectCD - -OPTION = -INCS = -I. -I$(GENDEV)/m68k-elf/include -I$(GENDEV)/m68k-elf/m68k-elf/include -Isrc -Ires -CCFLAGS = $(OPTION) -m68000 -Wall -O2 -c -fomit-frame-pointer -HWCCFLAGS = $(OPTION) -m68000 -Wall -O1 -c -fomit-frame-pointer -Z80FLAGS = -vb2 -ASFLAGS = -m68000 --register-prefix-optional -#LIBS = -L$(GENDEV)/m68k-elf/lib -L$(GENDEV)/m68k-elf/lib/gcc/m68k-elf/4.8.2 -L$(GENDEV)/m68k-elf/m68k-elf/lib -lmd -lc -lgcc -lnosys -lm -LIBS = -L$(GENDEV)/m68k-elf/lib -L$(GENDEV)/m68k-elf/lib/gcc/m68k-elf/* -L$(GENDEV)/m68k-elf/m68k-elf/lib -lmd -lnosys -LINKFLAGS = -T $(GENDEV)/ldscripts/sgdk.ld -nostdlib -SCDLINKFLAGS = -T scd/mdcd.ld -nostdlib -ARCHIVES = $(GENDEV)/m68k-elf/lib/libmd.a - - -# Are we AMD64? -#LBITS := $(shell getconf LONG_BIT) -#ifeq ($(LBITS), 64) -#ARCHIVES += $(GENDEV)/m68k-elf/lib64/gcc/m68k-elf/$(GCC_VER)/libgcc.a -#else -#ARCHIVES += $(GENDEV)/m68k-elf/lib/gcc/m68k-elf/$(GCC_VER)/libgcc.a -#endif - -ARCHIVES += $(GENDEV)/m68k-elf/$(LIB)/gcc/m68k-elf/$(GCC_VER)/libgcc.a - -RESOURCES= -BOOT_RESOURCES= - -BOOTSS=$(wildcard boot/*.s) -BOOTSS+=$(wildcard src/boot/*.s) -BOOT_RESOURCES+=$(BOOTSS:.s=.o) - -SCDBOOTSS=$(wildcard scd/*.s) -SCDBOOTSS+=$(wildcard src/scd/*.s) -SCDBOOT_RESOURCES=$(SCDBOOTSS:.s=.o) - -#BMPS=$(wildcard res/*.bmp) -#VGMS=$(wildcard res/*.vgm) -#RAWS=$(wildcard res/*.raw) -#PCMS=$(wildcard res/*.pcm) -#MVSS=$(wildcard res/*.mvs) -#TFDS=$(wildcard res/*.tfd) -#WAVS=$(wildcard res/*.wav) -RESS=$(wildcard res/*.res) -#WAVPCMS=$(wildcard res/*.wavpcm) -#BMPS+=$(wildcard *.bmp) -#VGMS+=$(wildcard *.vgm) -#RAWS+=$(wildcard *.raw) -#PCMS+=$(wildcard *.pcm) -#MVSS+=$(wildcard *.mvs) -#TFDS+=$(wildcard *.tfd) -#WAVS+=$(wildcard *.wav) -RESS+=$(wildcard *.res) -#WAVPCMS+=$(wildcard *.wavpcm) - -#RESOURCES+=$(BMPS:.bmp=.o) -#RESOURCES+=$(VGMS:.vgm=.o) -#RESOURCES+=$(RAWS:.raw=.o) -#RESOURCES+=$(PCMS:.pcm=.o) -#RESOURCES+=$(MVSS:.mvs=.o) -#RESOURCES+=$(TFDS:.tfd=.o) -#RESOURCES+=$(WAVS:.wav=.o) -#RESOURCES+=$(WAVPCMS:.wavpcm=.o) -RESOURCES+=$(RESS:.res=.o) - -CS=$(wildcard src/*.c) -SS=$(wildcard src/*.s) -S80S=$(wildcard src/*.s80) -CS+=$(wildcard *.c) -SS+=$(wildcard *.s) -S80S+=$(wildcard *.s80) -RESOURCES+=$(CS:.c=.o) -RESOURCES+=$(SS:.s=.o) -RESOURCES+=$(S80S:.s80=.o) - -OBJS = $(RESOURCES) - -all: out.bin - -boot/sega.o: boot/rom_head.bin - $(AS) $(ASFLAGS) boot/sega.s -o $@ - -scd/segacd.o: - $(AS) $(ASFLAGS) scd/segacd.s -o $@ - - -out.iso: out.elf_scd - # - # Create a sega cd image. Limited to 256K or smaller Roms - # - $(NM) -n -S -t x out.elf_scd > out.nm - $(OBJC) -O binary out.elf_scd out.bin - $(SIZEBND) out.bin -sizealign 131072 - $(OBJC) -O binary out.elf_scd $(SCD_LOADER)/_filesystem/M_INIT.PRG - $(SIZEBND) $(SCD_LOADER)/_filesystem/M_INIT.PRG -sizealign 131072 - $(MKISOFS) -iso-level 1 -o $(SCD_LOADER)/filesystem.img -pad $(SCD_LOADER)/_filesystem - tail -c +32769 $(SCD_LOADER)/filesystem.img > $(SCD_LOADER)/filesystem.bin - $(RM) -f $(SCD_LOADER)/filesystem.img - cd $(SCD_LOADER) && $(AS) $(ASFLAGS) -M -ahlsm=listing.asm main-us-as.asm -o out.iso - tail -c +53 $(SCD_LOADER)/out.iso > out.iso - $(RM) -f $(SCD_LOADER)/filesystem.bin - -%.bin: %.elf - $(OBJC) -O binary $< temp.bin - dd if=temp.bin of=$@ bs=8K conv=sync - -%.elf: $(OBJS) $(BOOT_RESOURCES) - $(CC) -o $@ $(LINKFLAGS) $(BOOT_RESOURCES) $(ARCHIVES) $(OBJS) $(LIBS) - -%.elf_scd: $(OBJS) $(SCDBOOT_RESOURCES) - $(CC) -o $@ $(SCDLINKFLAGS) $(SCDBOOT_RESOURCES) $(ARCHIVES) $(OBJS) $(LIBS) - -%.o80: %.s80 - $(ASMZ80) $(Z80FLAGS) -o $@ $< - -%.c: %.o80 - $(BINTOS) $< - -%.o: %.c - $(CC) $(CCFLAGS) $(INCS) -c $< -o $@ - -%.o: %.s - $(AS) $(ASFLAGS) $< -o $@ - -%.s: %.bmp - bintos -bmp $< - -%.rawpcm: %.pcm - $(PCMTORAW) $< $@ - -%.raw: %.wav - $(WAVTORAW) $< $@ 16000 - -%.pcm: %.wavpcm - $(WAVTORAW) $< $@ 22050 - -#%.tfc: %.tfd -# $(TFMCOM) $< - -#%.o80: %.s80 -# $(ASMZ80) $(FLAGSZ80) $< $@ out.lst - -%.s: %.tfd - $(BINTOS) -align 32768 $< - -%.s: %.mvs - $(BINTOS) -align 256 $< - -%.s: %.esf - $(BINTOS) -align 32768 $< - -%.s: %.eif - $(BINTOS) -align 256 $< - -%.s: %.vgm - $(BINTOS) -align 256 $< - -%.s: %.raw - $(BINTOS) -align 256 -sizealign 256 $< - -%.s: %.rawpcm - $(BINTOS) -align 128 -sizealign 128 -nullfill 136 $< - -%.s: %.rawpcm - $(BINTOS) -align 128 -sizealign 128 -nullfill 136 $< - -%.s: %.res - $(RESCOMP) $< $@ - -boot/rom_head.bin: boot/rom_head.o - $(LD) $(LINKFLAGS) --oformat binary -o $@ $< - - -clean: - $(RM) $(RESOURCES) - $(RM) *.o *.bin *.elf *.elf_scd *.map *.iso - $(RM) boot/*.o boot/*.bin diff --git a/examples/3d_example_2/main.c b/examples/3d_example_2/main.c index 128efee..f6dd445 100644 --- a/examples/3d_example_2/main.c +++ b/examples/3d_example_2/main.c @@ -2,7 +2,7 @@ #include "meshs.h" -#define MAX_POINTS 256 +#define MAX_POINTS 256 #define DEBUG 0 @@ -27,7 +27,7 @@ Transformation3D transformation; Vect3D_f16 rotstep; -Vect3D_f16 camvec = {FIX16(0),FIX16(0),FIX16(12)}; +Vect3D_f16 camvec = {FIX16(0),FIX16(0),FIX16(12)}; u16 flatDrawing; @@ -53,50 +53,50 @@ fix16 get_distance(Vect3D_f16 v1, Vect3D_f16 v2) { //fix16 distance_2 = fix16Sqrt((xd*xd + yd*yd + zd*zd)); //fix16 distance_2 = fix16Sqrt(xd*xd+yd*yd+zd*zd); - // Taxicab distance for now + // Taxicab distance for now #if 1 return (abs(v2.x-v1.x) + abs(v2.y-v1.y) + abs(v2.z-v1.z)); #endif } -u16 Partition_polymesh(polymesh **data, u16 p, u16 r) -{ - polymesh* x = data[p]; - u16 i = p - 1; - u16 j = r + 1; - - while (TRUE) - { - i++; - while ((i < r) && (data[i]->distance < x->distance)) i++; - j--; - while ((j > p) && (data[j]->distance > x->distance)) j--; - - if (i < j) - { - polymesh* tmp; - - tmp = data[i]; - data[i] = data[j]; - data[j] = tmp; - } - else - return j; - } -} - +u16 Partition_polymesh(polymesh **data, u16 p, u16 r) +{ + polymesh* x = data[p]; + u16 i = p - 1; + u16 j = r + 1; + + while (TRUE) + { + i++; + while ((i < r) && (data[i]->distance < x->distance)) i++; + j--; + while ((j > p) && (data[j]->distance > x->distance)) j--; + + if (i < j) + { + polymesh* tmp; + + tmp = data[i]; + data[i] = data[j]; + data[j] = tmp; + } + else + return j; + } +} + void sort_polymeshs(polymesh** data, u16 p, u16 r) { - if (p < r) - { - u16 q = Partition_polymesh(data, p, r); - sort_polymeshs(data, p, q); - sort_polymeshs(data, q + 1, r); - } + if (p < r) + { + u16 q = Partition_polymesh(data, p, r); + sort_polymeshs(data, p, q); + sort_polymeshs(data, q + 1, r); + } } void render(polymesh** poly_list, u8 list_len, Transformation3D* transform) { Vect3D_f16 v1; -#if DEBUG +#if DEBUG Vect2D_s16 cpts_2D[10]; #endif u8 i; @@ -112,7 +112,7 @@ void render(polymesh** poly_list, u8 list_len, Transformation3D* transform) { } M3D_transform(transform, stars_3D, stars_t3D, NUM_STARS); - M3D_project_s16(stars_t3D, stars_t2D, NUM_STARS); + M3D_project_s16(stars_t3D, stars_t2D, NUM_STARS); BMP_setPixels_V2D(stars_t2D, 15, NUM_STARS); #if DEBUG @@ -149,7 +149,7 @@ void render(polymesh** poly_list, u8 list_len, Transformation3D* transform) { m.pt1.y-=20; BMP_drawLine(&m); - + m.pt1 = cpts_2D[i]; m.pt2 = cpts_2D[i]; @@ -178,7 +178,7 @@ int main() JOY_setEventHandler(handleJoyEvent); //BMP_init(TRUE, PAL1, FALSE); - BMP_init(FALSE, PAL0, FALSE); + BMP_init(TRUE, PLAN_A, PAL1, FALSE); //BGR ? @@ -208,11 +208,11 @@ int main() flatDrawing = 1; rotstep.y = FIX16(0.2); - + light_mask[0] = 0x00; - light_mask[1] = 0x10; + light_mask[1] = 0x10; light_mask[2] = 0x20; - + int i; for(i=0;ix) + fix16Mul(transformation.lightInv.y, norm->y) + fix16Mul(transformation.lightInv.z, norm->z); col = *base_col + pal_offset; - + if (dp > 0) { light += (dp >> (FIX16_FRAC_BITS - 1)); if (light >= 3) { @@ -309,7 +309,7 @@ void drawPoints(u8 col, polymesh inpoly) } else { col = light_mask[light] | col; } - } else { + } else { col = light_mask[0] | col; } @@ -323,7 +323,7 @@ void drawPoints(u8 col, polymesh inpoly) #endif } else { #if DEBUG - BMP_drawText("CULLED", 10, i); + BMP_drawText("CULLED", 10, i); #endif } base_col++; @@ -338,7 +338,7 @@ void drawPoints(u8 col, polymesh inpoly) l.col = col; line_ind = inpoly.line_ind; - + // Number of lines i = inpoly.num_edges; diff --git a/pkg/DEBIAN/control b/pkg/DEBIAN/control index 81a189c..9bddf11 100644 --- a/pkg/DEBIAN/control +++ b/pkg/DEBIAN/control @@ -3,7 +3,7 @@ Version: ##VER## Section: devel Priority: optional Maintainer: Matt Kubilus (mattkubilus) -Depends: texinfo +Depends: texinfo, openjdk-8-jre, make Architecture: all Homepage: https://github.com/kubilus1/gendev Description: Sega Genesis development on *nix. diff --git a/sgdk/Makefile b/sgdk/Makefile index cf99a1a..1369ba9 100644 --- a/sgdk/Makefile +++ b/sgdk/Makefile @@ -4,47 +4,34 @@ GENGCC_BIN=$(GENDEV)/bin SGDKDIR=$(CURDIR)/SGDK SAMPLESDIR=$(SGDKDIR)/sample -SGDKVER=1.34 +SGDKVER=v1.40 SGDKINSTALLDIR=$(GENDEV)/sgdk$(SGDKVER) - -all: tools $(SGDKDIR) $(SGDKDIR)/libmd.a +all: tools $(SGDKDIR) $(SGDKDIR)/libmd.a tools: $(SGDKDIR) cd $(SGDKDIR)/tools/bintos/src && \ gcc -o bintos bintos.c && cp bintos $(GENDEV)/bin/. - cd $(SGDKDIR)/tools/pcmtoraw/src && \ - gcc -o pcmtoraw pcmtoraw.c && cp pcmtoraw $(GENDEV)/bin/. cd $(SGDKDIR)/tools/sizebnd/src && \ gcc -o sizebnd sizebnd.c && cp sizebnd $(GENDEV)/bin/. - cd $(SGDKDIR)/tools/wavtoraw/src && \ - gcc -o wavtoraw wavtoraw.c -lm && cp wavtoraw $(GENDEV)/bin/. cd $(SGDKDIR)/tools/xgmtool && \ $(MAKE) -f ../../../files/Makefile.xgmtool && cp out/xgmtool $(GENDEV)/bin/. - cd $(SGDKDIR)/tools/rescomp && \ - $(MAKE) -f ../../../files/Makefile.rescomp && cp out/rescomp $(GENDEV)/bin/. - #patch -u -p0 < ../../../files/rescomp.diff && \ - # - cp $(SGDKDIR)/bin/lz4w.jar $(GENDEV)/bin/. + cp $(SGDKDIR)/bin/*.jar $(GENDEV)/bin/. patch: cd $(SGDKDIR) && git diff * > ../files/sgdk.diff prep: - cd $(SGDKDIR) && patch -u -p1 < ../files/sgdk.diff + cd $(SGDKDIR) && patch -u -p1 -l < ../files/sgdk.diff $(SGDKDIR): git clone -b '$(SGDKVER)' --single-branch --depth 1 https://github.com/Stephane-D/SGDK.git - #git clone https://github.com/Stephane-D/SGDK.git - #cd $(SGDKDIR) && $ git checkout tags/$(SGDKVER) - cd $(SGDKDIR) && patch -u -p1 < ../files/sgdk.diff - #cp files/makefile.vars $(SGDKDIR)/. - #git clone https://github.com/kubilus1/SGDK.git $(SGDKDIR) - #patch -u -p0 < files/sgdk.diff + cd $(SGDKDIR) && find . -regextype posix-extended -regex '.*make(lib|file).*' -exec dos2unix {} \; && patch -u -p1 -l < ../files/sgdk.diff $(SGDKDIR)/libmd.a: $(SGDKDIR) + cp -rf ../tools/files/applib/lib $(SGDKDIR)/tools/appack cd $(SGDKDIR) && ln -sf ../files/Makefile.sgdk_lib . - cd $(SGDKDIR) && $(MAKE) -f Makefile.sgdk_lib + cd $(SGDKDIR) && $(MAKE) -f Makefile.sgdk_lib $(SGDKINSTALLDIR): mkdir -p $@ @@ -58,9 +45,7 @@ install: tools $(SGDKDIR)/libmd.a $(SGDKINSTALLDIR) mkdir -p $(GENDEV)/sgdk/lib mkdir -p $(GENDEV)/sgdk/res mkdir -p $(GENDEV)/sgdk/mkfiles - #cd $(SGDKDIR) && $(MAKE) -f Makefile.sgdk_lib install cp $(SGDKDIR)/md.ld $(GENDEV)/sgdk/. - #cp -r ./skeleton $(GENDEV)/. cp $(SGDKDIR)/inc/* $(GENDEV)/sgdk/inc/. cp -r $(SGDKDIR)/src/boot $(GENDEV)/sgdk/src/. cp -r $(SGDKDIR)/res/* $(GENDEV)/sgdk/res/. @@ -68,6 +53,7 @@ install: tools $(SGDKDIR)/libmd.a $(SGDKINSTALLDIR) cp $(SGDKDIR)/libmd.a $(GENDEV)/sgdk/lib/. cp $(SGDKDIR)/makefile.gen $(GENDEV)/sgdk/mkfiles/. cp files/makefile.vars $(GENDEV)/sgdk/mkfiles/. + cp $(SGDKDIR)/tools/sizebnd/src/sizebnd $(GENDEV)/bin/ SAMPLES=$(wildcard $(SAMPLESDIR)/*/out) SAMPLEROMS=$(addsuffix /rom.bin,$(SAMPLES)) @@ -78,7 +64,7 @@ sample_clean: $(CLEANSAMPLES) @echo "Done cleaning samples" $(CLEANSAMPLES): - cd $@/.. && $(MAKE) -f $(GENDEV)/sgdk/mkfiles/makefile.gen clean + cd $@/.. && $(MAKE) -f $(SGDKDIR)/makefile.gen clean samples: $(SAMPLEROMS) @echo "All samples built" diff --git a/sgdk/files/Makefile.rescomp b/sgdk/files/Makefile.rescomp deleted file mode 100644 index edd573e..0000000 --- a/sgdk/files/Makefile.rescomp +++ /dev/null @@ -1,198 +0,0 @@ -#------------------------------------------------------------------------------# -# This makefile was generated by 'cbp2make' tool rev.147 # -#------------------------------------------------------------------------------# - - -WORKDIR = `pwd` - -CC = gcc -CXX = g++ -AR = ar -LD = g++ -WINDRES = windres - -INC = -CFLAGS = -Wall -RESINC = -LIBDIR = -LIB = -LDFLAGS = - -INC_DEBUG = $(INC) -CFLAGS_DEBUG = $(CFLAGS) -g -RESINC_DEBUG = $(RESINC) -RCFLAGS_DEBUG = $(RCFLAGS) -LIBDIR_DEBUG = $(LIBDIR) -LIB_DEBUG = $(LIB) -LDFLAGS_DEBUG = $(LDFLAGS) -OBJDIR_DEBUG = out -DEP_DEBUG = -OUT_DEBUG = out/rescomp - -INC_RELEASE = $(INC) -CFLAGS_RELEASE = $(CFLAGS) -O2 -RESINC_RELEASE = $(RESINC) -RCFLAGS_RELEASE = $(RCFLAGS) -LIBDIR_RELEASE = $(LIBDIR) -LIB_RELEASE = $(LIB) -LDFLAGS_RELEASE = $(LDFLAGS) -s -OBJDIR_RELEASE = out -DEP_RELEASE = -OUT_RELEASE = out/rescomp - -OBJ_DEBUG = $(OBJDIR_DEBUG)/src/snd_tools.o $(OBJDIR_DEBUG)/src/bin.o $(OBJDIR_DEBUG)/src/bitmap.o $(OBJDIR_DEBUG)/src/image.o $(OBJDIR_DEBUG)/src/img_tools.o $(OBJDIR_DEBUG)/src/libpng.o $(OBJDIR_DEBUG)/src/map.o $(OBJDIR_DEBUG)/src/palette.o $(OBJDIR_DEBUG)/src/pcm.o $(OBJDIR_DEBUG)/src/rescomp.o $(OBJDIR_DEBUG)/src/spr_tools.o $(OBJDIR_DEBUG)/src/sprite.o $(OBJDIR_DEBUG)/src/tfmmusic.o $(OBJDIR_DEBUG)/src/tile_tools.o $(OBJDIR_DEBUG)/src/tileset.o $(OBJDIR_DEBUG)/src/tools.o $(OBJDIR_DEBUG)/src/vgmmusic.o $(OBJDIR_DEBUG)/src/wav.o $(OBJDIR_DEBUG)/src/xgmmusic.o - -OBJ_RELEASE = $(OBJDIR_RELEASE)/src/snd_tools.o $(OBJDIR_RELEASE)/src/bin.o $(OBJDIR_RELEASE)/src/bitmap.o $(OBJDIR_RELEASE)/src/image.o $(OBJDIR_RELEASE)/src/img_tools.o $(OBJDIR_RELEASE)/src/libpng.o $(OBJDIR_RELEASE)/src/map.o $(OBJDIR_RELEASE)/src/palette.o $(OBJDIR_RELEASE)/src/pcm.o $(OBJDIR_RELEASE)/src/rescomp.o $(OBJDIR_RELEASE)/src/spr_tools.o $(OBJDIR_RELEASE)/src/sprite.o $(OBJDIR_RELEASE)/src/tfmmusic.o $(OBJDIR_RELEASE)/src/tile_tools.o $(OBJDIR_RELEASE)/src/tileset.o $(OBJDIR_RELEASE)/src/tools.o $(OBJDIR_RELEASE)/src/vgmmusic.o $(OBJDIR_RELEASE)/src/wav.o $(OBJDIR_RELEASE)/src/xgmmusic.o - -all: debug release - -clean: clean_debug clean_release - -before_debug: - test -d out || mkdir -p out - test -d $(OBJDIR_DEBUG)/src || mkdir -p $(OBJDIR_DEBUG)/src - -after_debug: - -debug: before_debug out_debug after_debug - -out_debug: before_debug $(OBJ_DEBUG) $(DEP_DEBUG) - $(LD) $(LIBDIR_DEBUG) -o $(OUT_DEBUG) $(OBJ_DEBUG) $(LDFLAGS_DEBUG) $(LIB_DEBUG) - -$(OBJDIR_DEBUG)/src/snd_tools.o: src/snd_tools.c - $(CC) $(CFLAGS_DEBUG) $(INC_DEBUG) -c src/snd_tools.c -o $(OBJDIR_DEBUG)/src/snd_tools.o - -$(OBJDIR_DEBUG)/src/bin.o: src/bin.c - $(CC) $(CFLAGS_DEBUG) $(INC_DEBUG) -c src/bin.c -o $(OBJDIR_DEBUG)/src/bin.o - -$(OBJDIR_DEBUG)/src/bitmap.o: src/bitmap.c - $(CC) $(CFLAGS_DEBUG) $(INC_DEBUG) -c src/bitmap.c -o $(OBJDIR_DEBUG)/src/bitmap.o - -$(OBJDIR_DEBUG)/src/image.o: src/image.c - $(CC) $(CFLAGS_DEBUG) $(INC_DEBUG) -c src/image.c -o $(OBJDIR_DEBUG)/src/image.o - -$(OBJDIR_DEBUG)/src/img_tools.o: src/img_tools.c - $(CC) $(CFLAGS_DEBUG) $(INC_DEBUG) -c src/img_tools.c -o $(OBJDIR_DEBUG)/src/img_tools.o - -$(OBJDIR_DEBUG)/src/libpng.o: src/libpng.c - $(CC) $(CFLAGS_DEBUG) $(INC_DEBUG) -c src/libpng.c -o $(OBJDIR_DEBUG)/src/libpng.o - -$(OBJDIR_DEBUG)/src/map.o: src/map.c - $(CC) $(CFLAGS_DEBUG) $(INC_DEBUG) -c src/map.c -o $(OBJDIR_DEBUG)/src/map.o - -$(OBJDIR_DEBUG)/src/palette.o: src/palette.c - $(CC) $(CFLAGS_DEBUG) $(INC_DEBUG) -c src/palette.c -o $(OBJDIR_DEBUG)/src/palette.o - -$(OBJDIR_DEBUG)/src/pcm.o: src/pcm.c - $(CC) $(CFLAGS_DEBUG) $(INC_DEBUG) -c src/pcm.c -o $(OBJDIR_DEBUG)/src/pcm.o - -$(OBJDIR_DEBUG)/src/rescomp.o: src/rescomp.c - $(CC) $(CFLAGS_DEBUG) $(INC_DEBUG) -c src/rescomp.c -o $(OBJDIR_DEBUG)/src/rescomp.o - -$(OBJDIR_DEBUG)/src/spr_tools.o: src/spr_tools.c - $(CC) $(CFLAGS_DEBUG) $(INC_DEBUG) -c src/spr_tools.c -o $(OBJDIR_DEBUG)/src/spr_tools.o - -$(OBJDIR_DEBUG)/src/sprite.o: src/sprite.c - $(CC) $(CFLAGS_DEBUG) $(INC_DEBUG) -c src/sprite.c -o $(OBJDIR_DEBUG)/src/sprite.o - -$(OBJDIR_DEBUG)/src/tfmmusic.o: src/tfmmusic.c - $(CC) $(CFLAGS_DEBUG) $(INC_DEBUG) -c src/tfmmusic.c -o $(OBJDIR_DEBUG)/src/tfmmusic.o - -$(OBJDIR_DEBUG)/src/tile_tools.o: src/tile_tools.c - $(CC) $(CFLAGS_DEBUG) $(INC_DEBUG) -c src/tile_tools.c -o $(OBJDIR_DEBUG)/src/tile_tools.o - -$(OBJDIR_DEBUG)/src/tileset.o: src/tileset.c - $(CC) $(CFLAGS_DEBUG) $(INC_DEBUG) -c src/tileset.c -o $(OBJDIR_DEBUG)/src/tileset.o - -$(OBJDIR_DEBUG)/src/tools.o: src/tools.c - $(CC) $(CFLAGS_DEBUG) $(INC_DEBUG) -c src/tools.c -o $(OBJDIR_DEBUG)/src/tools.o - -$(OBJDIR_DEBUG)/src/vgmmusic.o: src/vgmmusic.c - $(CC) $(CFLAGS_DEBUG) $(INC_DEBUG) -c src/vgmmusic.c -o $(OBJDIR_DEBUG)/src/vgmmusic.o - -$(OBJDIR_DEBUG)/src/wav.o: src/wav.c - $(CC) $(CFLAGS_DEBUG) $(INC_DEBUG) -c src/wav.c -o $(OBJDIR_DEBUG)/src/wav.o - -$(OBJDIR_DEBUG)/src/xgmmusic.o: src/xgmmusic.c - $(CC) $(CFLAGS_DEBUG) $(INC_DEBUG) -c src/xgmmusic.c -o $(OBJDIR_DEBUG)/src/xgmmusic.o - -clean_debug: - rm -f $(OBJ_DEBUG) $(OUT_DEBUG) - rm -rf out - rm -rf $(OBJDIR_DEBUG)/src - -before_release: - test -d out || mkdir -p out - test -d $(OBJDIR_RELEASE)/src || mkdir -p $(OBJDIR_RELEASE)/src - -after_release: - -release: before_release out_release after_release - -out_release: before_release $(OBJ_RELEASE) $(DEP_RELEASE) - $(LD) $(LIBDIR_RELEASE) -o $(OUT_RELEASE) $(OBJ_RELEASE) $(LDFLAGS_RELEASE) $(LIB_RELEASE) - -$(OBJDIR_RELEASE)/src/snd_tools.o: src/snd_tools.c - $(CC) $(CFLAGS_RELEASE) $(INC_RELEASE) -c src/snd_tools.c -o $(OBJDIR_RELEASE)/src/snd_tools.o - -$(OBJDIR_RELEASE)/src/bin.o: src/bin.c - $(CC) $(CFLAGS_RELEASE) $(INC_RELEASE) -c src/bin.c -o $(OBJDIR_RELEASE)/src/bin.o - -$(OBJDIR_RELEASE)/src/bitmap.o: src/bitmap.c - $(CC) $(CFLAGS_RELEASE) $(INC_RELEASE) -c src/bitmap.c -o $(OBJDIR_RELEASE)/src/bitmap.o - -$(OBJDIR_RELEASE)/src/image.o: src/image.c - $(CC) $(CFLAGS_RELEASE) $(INC_RELEASE) -c src/image.c -o $(OBJDIR_RELEASE)/src/image.o - -$(OBJDIR_RELEASE)/src/img_tools.o: src/img_tools.c - $(CC) $(CFLAGS_RELEASE) $(INC_RELEASE) -c src/img_tools.c -o $(OBJDIR_RELEASE)/src/img_tools.o - -$(OBJDIR_RELEASE)/src/libpng.o: src/libpng.c - $(CC) $(CFLAGS_RELEASE) $(INC_RELEASE) -c src/libpng.c -o $(OBJDIR_RELEASE)/src/libpng.o - -$(OBJDIR_RELEASE)/src/map.o: src/map.c - $(CC) $(CFLAGS_RELEASE) $(INC_RELEASE) -c src/map.c -o $(OBJDIR_RELEASE)/src/map.o - -$(OBJDIR_RELEASE)/src/palette.o: src/palette.c - $(CC) $(CFLAGS_RELEASE) $(INC_RELEASE) -c src/palette.c -o $(OBJDIR_RELEASE)/src/palette.o - -$(OBJDIR_RELEASE)/src/pcm.o: src/pcm.c - $(CC) $(CFLAGS_RELEASE) $(INC_RELEASE) -c src/pcm.c -o $(OBJDIR_RELEASE)/src/pcm.o - -$(OBJDIR_RELEASE)/src/rescomp.o: src/rescomp.c - $(CC) $(CFLAGS_RELEASE) $(INC_RELEASE) -c src/rescomp.c -o $(OBJDIR_RELEASE)/src/rescomp.o - -$(OBJDIR_RELEASE)/src/spr_tools.o: src/spr_tools.c - $(CC) $(CFLAGS_RELEASE) $(INC_RELEASE) -c src/spr_tools.c -o $(OBJDIR_RELEASE)/src/spr_tools.o - -$(OBJDIR_RELEASE)/src/sprite.o: src/sprite.c - $(CC) $(CFLAGS_RELEASE) $(INC_RELEASE) -c src/sprite.c -o $(OBJDIR_RELEASE)/src/sprite.o - -$(OBJDIR_RELEASE)/src/tfmmusic.o: src/tfmmusic.c - $(CC) $(CFLAGS_RELEASE) $(INC_RELEASE) -c src/tfmmusic.c -o $(OBJDIR_RELEASE)/src/tfmmusic.o - -$(OBJDIR_RELEASE)/src/tile_tools.o: src/tile_tools.c - $(CC) $(CFLAGS_RELEASE) $(INC_RELEASE) -c src/tile_tools.c -o $(OBJDIR_RELEASE)/src/tile_tools.o - -$(OBJDIR_RELEASE)/src/tileset.o: src/tileset.c - $(CC) $(CFLAGS_RELEASE) $(INC_RELEASE) -c src/tileset.c -o $(OBJDIR_RELEASE)/src/tileset.o - -$(OBJDIR_RELEASE)/src/tools.o: src/tools.c - $(CC) $(CFLAGS_RELEASE) $(INC_RELEASE) -c src/tools.c -o $(OBJDIR_RELEASE)/src/tools.o - -$(OBJDIR_RELEASE)/src/vgmmusic.o: src/vgmmusic.c - $(CC) $(CFLAGS_RELEASE) $(INC_RELEASE) -c src/vgmmusic.c -o $(OBJDIR_RELEASE)/src/vgmmusic.o - -$(OBJDIR_RELEASE)/src/wav.o: src/wav.c - $(CC) $(CFLAGS_RELEASE) $(INC_RELEASE) -c src/wav.c -o $(OBJDIR_RELEASE)/src/wav.o - -$(OBJDIR_RELEASE)/src/xgmmusic.o: src/xgmmusic.c - $(CC) $(CFLAGS_RELEASE) $(INC_RELEASE) -c src/xgmmusic.c -o $(OBJDIR_RELEASE)/src/xgmmusic.o - -clean_release: - rm -f $(OBJ_RELEASE) $(OUT_RELEASE) - rm -rf out - rm -rf $(OBJDIR_RELEASE)/src - -.PHONY: before_debug after_debug clean_debug before_release after_release clean_release - diff --git a/sgdk/files/Makefile.sgdk_lib b/sgdk/files/Makefile.sgdk_lib index a4bdf15..031fec2 100644 --- a/sgdk/files/Makefile.sgdk_lib +++ b/sgdk/files/Makefile.sgdk_lib @@ -3,16 +3,16 @@ MAKE?=make GENGCC_BIN=$(GENDEV)/bin GENBIN=$(GENDEV)/bin -CC = $(GENGCC_BIN)/m68k-elf-gcc -AR = $(GENGCC_BIN)/m68k-elf-ar -RANLIB = $(GENGCC_BIN)/m68k-elf-ranlib -OBJC = $(GENGCC_BIN)/m68k-elf-objcopy -RM = rm -f -ASMZ80 = $(GENBIN)/sjasm -BINTOS = $(GENBIN)/bintos -RESCOMP= $(GENBIN)/rescomp +CC = $(GENGCC_BIN)/m68k-elf-gcc +AR = $(GENGCC_BIN)/m68k-elf-ar +RANLIB = $(GENGCC_BIN)/m68k-elf-ranlib +OBJC = $(GENGCC_BIN)/m68k-elf-objcopy +RM = rm -f +ASMZ80 = $(GENBIN)/sjasm +BINTOS = $(GENBIN)/bintos +RESCOMP= java -jar ./bin/rescomp.jar -OPTION= -Dnologo_ +OPTION= -Dnologo_ CS=$(wildcard src/*.c) SS=$(wildcard src/*.s) @@ -24,41 +24,46 @@ RESOURCES+=$(CS:.c=.o) RESOURCES+=$(SS:.s=.o) RESOURCES+=$(S80S:.s80=.o) - libmd.a_OBJS=$(RESOURCES) INCS = -Iinc -Ires -FLAGS = $(OPTION) -m68000 -Wall -O1 -c -fomit-frame-pointer $(INCS) -FLAGSZ80 = -isrc -iinc +FLAGS = $(OPTION) -m68000 -Wall -O1 -c -fomit-frame-pointer $(INCS) +FLAGSZ80 = -isrc -iinc + +all: appack $(libmd.a_OBJS) libmd.a -all: $(libmd.a_OBJS) libmd.a +appack: + echo -n "osBits="> tools/appack/makefile.vars + getconf LONG_BIT >> tools/appack/makefile.vars + cd tools/appack/ && make -f makefile.elf + cp tools/appack/appack bin/ -%.a: $(libmd.a_OBJS) - $(RM) $@ - $(AR) cru $@ $($@_OBJS) - $(RANLIB) $@ +%.a: $(libmd.a_OBJS) + $(RM) $@ + $(AR) cru $@ $($@_OBJS) + $(RANLIB) $@ -%.o80: %.s80 - $(ASMZ80) $(FLAGSZ80) $< $@ out.lst +%.o80: %.s80 + $(ASMZ80) $(FLAGSZ80) $< $@ out.lst -%.s: %.o80 - $(BINTOS) $< +%.s: %.o80 + $(BINTOS) $< -%.o: %.c - $(CC) $(FLAGS) -c $< -o $@ +%.o: %.c + $(CC) $(FLAGS) -c $< -o $@ -%.o: %.s - $(CC) $(FLAGS) -c $< -o $@ +%.o: %.s + $(CC) $(FLAGS) -c $< -o $@ %.s: %.res $(RESCOMP) $< $@ -clean: - #$(RM) -f z80_drv1.c z80_drv2.c +clean: + #$(RM) -f z80_drv1.c z80_drv2.c $(RM) $(RESOURCES) - $(RM) -rf *.o *.a *.o80 *.log *.lst + $(RM) -rf *.o *.a *.o80 *.log *.lst -install: all - cp inc/*.h $(GENDEV)/m68k-elf/include - cp res/*.h $(GENDEV)/m68k-elf/include - cp libmd.a $(GENDEV)/m68k-elf/lib +install: all + cp inc/*.h $(GENDEV)/m68k-elf/include + cp res/*.h $(GENDEV)/m68k-elf/include + cp libmd.a $(GENDEV)/m68k-elf/lib diff --git a/sgdk/files/makefile.vars b/sgdk/files/makefile.vars index 670ca5e..65a3383 100644 --- a/sgdk/files/makefile.vars +++ b/sgdk/files/makefile.vars @@ -1,9 +1,21 @@ +############################################################################### +# Gendev specific vars PATH := $(GENDEV)/bin:$(PATH) GENGCC_BIN= $(GENDEV)/bin GENBIN= $(GENDEV)/bin GDK= $(GENDEV)/sgdk + +AS = $(GENGCC_BIN)/m68k-elf-as +AR = $(GENGCC_BIN)/m68k-elf-ar +RANLIB = $(GENGCC_BIN)/m68k-elf-ranlib +NM2WCH = nm2wch +MKISOFS = mkisofs + +############################################################################### +# SGDK overrid vars LIB= $(GENDEV)/sgdk/lib + LIBSRC= $(GENDEV)/sgdk/src LIBRES= $(GENDEV)/sgdk/res LIBINCLUDE= $(GENDEV)/sgdk/inc @@ -12,28 +24,18 @@ SRC= src RES= res INCLUDE= inc -#MACCER= $(BIN)/mac68k - -MKDIR= mkdir -ECHO= echo -CP= cp SHELL= sh - -CC = $(GENGCC_BIN)/m68k-elf-gcc -AS = $(GENGCC_BIN)/m68k-elf-as -AR = $(GENGCC_BIN)/m68k-elf-ar +RM = rm -f +CP= cp +CC = $(GENGCC_BIN)/m68k-elf-gcc LD = $(GENGCC_BIN)/m68k-elf-ld -RANLIB = $(GENGCC_BIN)/m68k-elf-ranlib -OBJCPY = $(GENGCC_BIN)/m68k-elf-objcopy -BINTOS = $(GENBIN)/bintos -RESCOMP= $(GENBIN)/rescomp -XGMTOOL= $(GENBIN)/xgmtool -PCMTORAW = $(GENBIN)/pcmtoraw -WAVTORAW = $(GENBIN)/wavtoraw -SIZEBND = $(GENBIN)/sizebnd -ASMZ80 = $(GENBIN)/zasm - -RM = rm -f NM = nm -NM2WCH = nm2wch -MKISOFS = mkisofs +#JAVA= java +ECHO= echo +OBJCPY = $(GENGCC_BIN)/m68k-elf-objcopy +ASMZ80 = $(GENBIN)/zasm +#MACCER= $(BIN)/mac68k +SIZEBND= $(GENGCC_BIN)/sizebnd +BINTOS = $(GENBIN)/bintos +RESCOMP= $(JAVA) -jar $(GENBIN)/rescomp.jar +MKDIR= mkdir diff --git a/sgdk/files/sgdk.diff b/sgdk/files/sgdk.diff index f530a27..9934376 100644 --- a/sgdk/files/sgdk.diff +++ b/sgdk/files/sgdk.diff @@ -1,219 +1,31 @@ diff --git a/makefile.gen b/makefile.gen -index b9d7877..07d96af 100644 +index f12594d..d240b3f 100644 --- a/makefile.gen +++ b/makefile.gen -@@ -24,6 +24,8 @@ BINTOS= $(BIN)/bintos - RESCOMP= $(BIN)/rescomp - MKDIR= $(BIN)/mkdir - -+include $(GENDEV)/sgdk/mkfiles/makefile.vars -+ - SRC_C= $(wildcard *.c) - SRC_C+= $(wildcard $(SRC)/*.c) - SRC_S= $(wildcard *.s) -diff --git a/res/libres.h b/res/libres.h -index 1f6155d..f31e5b5 100644 ---- a/res/libres.h -+++ b/res/libres.h -@@ -1,9 +1,9 @@ --#ifndef _D__APPS_SGDK_RES_LIBRES_H_ --#define _D__APPS_SGDK_RES_LIBRES_H_ -+#ifndef _RES_LIBRES_H_ -+#define _RES_LIBRES_H_ - - extern const Bitmap logo_lib; - extern const TileSet font_lib; - extern const Palette font_pal_lib; - extern const u8 stop_xgm[172]; - --#endif // _D__APPS_SGDK_RES_LIBRES_H_ -+#endif // _RES_LIBRES_H_ -index 451564b..37b72b7 100644 ---- a/sample/hs_effect/src/boot/rom_head.c -+++ b/sample/hs_effect/src/boot/rom_head.c -@@ -1,6 +1,6 @@ - #include "types.h" - -- -+__attribute__((externally_visible)) - const struct - { - char console[16]; /* Console Name (16) */ -index 451564b..37b72b7 100644 ---- a/sample/joytest/src/boot/rom_head.c -+++ b/sample/joytest/src/boot/rom_head.c -@@ -1,6 +1,6 @@ - #include "types.h" - -- -+__attribute__((externally_visible)) - const struct - { - char console[16]; /* Console Name (16) */ -index 24d748b..ab8eb69 100644 ---- a/sample/sound/res/resources.res -+++ b/sample/sound/res/resources.res -@@ -7,7 +7,7 @@ XGM midnight "midnight.vgm" - VGM roadrash "roadrash.vgm" - VGM sonic1 "sonic1.vgm" - VGM bapcm_vgm "bad_apple_pcm.vgm" --TFM music_tfd "music_tfd.tfd" 1 -+#TFM music_tfd "music_tfd.tfd" 1 - BIN music_mvs "music_mvs.mvs" 256 - - WAV india_8k "india_8k.wav" 0 8000 -diff --git a/sample/sound/src/main.c b/sample/sound/src/main.c -index 117e891..498160b 100644 ---- a/sample/sound/src/main.c -+++ b/sample/sound/src/main.c -@@ -568,19 +568,6 @@ static void joyEvent(u16 joy, u16 changed, u16 state) - break; - } - -- case Z80_DRIVER_TFM: -- { -- if (changed & state & BUTTON_A) -- { -- SND_startPlay_TFM(music_tfd); -- } -- if (changed & state & BUTTON_START) -- { -- SND_stopPlay_TFM(); -- } -- break; -- } -- - case Z80_DRIVER_VGM: - { - if (changed & state & BUTTON_X) -diff --git a/src/z80_drv1.h b/src/z80_drv1.h -index 06adade..a2da7b8 100644 ---- a/src/z80_drv1.h -+++ b/src/z80_drv1.h -@@ -1,6 +1,6 @@ --#ifndef _Z80_DRV1_H_ --#define _Z80_DRV1_H_ -- --extern const u8 z80_drv1[0xB2B]; -- --#endif // _Z80_DRV1_H_ -+#ifndef _Z80_DRV1_H_ -+#define _Z80_DRV1_H_ -+ -+extern const u8 z80_drv1[0xB2B]; -+ -+#endif // _Z80_DRV1_H_ -diff --git a/src/z80_drv2.h b/src/z80_drv2.h -index 3598de1..7ef3aba 100644 ---- a/src/z80_drv2.h -+++ b/src/z80_drv2.h -@@ -1,6 +1,6 @@ --#ifndef _Z80_DRV2_H_ --#define _Z80_DRV2_H_ -- --extern const u8 z80_drv2[0xE00]; -- --#endif // _Z80_DRV2_H_ -+#ifndef _Z80_DRV2_H_ -+#define _Z80_DRV2_H_ -+ -+extern const u8 z80_drv2[0xE00]; -+ -+#endif // _Z80_DRV2_H_ -diff --git a/src/z80_drv3.h b/src/z80_drv3.h -index 8b35866..94c8000 100644 ---- a/src/z80_drv3.h -+++ b/src/z80_drv3.h -@@ -1,6 +1,6 @@ --#ifndef _Z80_DRV3_H_ --#define _Z80_DRV3_H_ -- --extern const u8 z80_drv3[0xA69]; -- --#endif // _Z80_DRV3_H_ -+#ifndef _Z80_DRV3_H_ -+#define _Z80_DRV3_H_ -+ -+extern const u8 z80_drv3[0xA69]; -+ -+#endif // _Z80_DRV3_H_ -diff --git a/src/z80_mvs.h b/src/z80_mvs.h -index 031a90f..661cbb0 100644 ---- a/src/z80_mvs.h -+++ b/src/z80_mvs.h -@@ -1,6 +1,6 @@ --#ifndef _Z80_MVS_H_ --#define _Z80_MVS_H_ -- --extern const u8 z80_mvs[0xA5B]; -- --#endif // _Z80_MVS_H_ -+#ifndef _Z80_MVS_H_ -+#define _Z80_MVS_H_ -+ -+extern const u8 z80_mvs[0xA5B]; -+ -+#endif // _Z80_MVS_H_ -diff --git a/src/z80_tfm.h b/src/z80_tfm.h -index 31e35a0..fe6fed3 100644 ---- a/src/z80_tfm.h -+++ b/src/z80_tfm.h -@@ -1,6 +1,6 @@ --#ifndef _Z80_TFM_H_ --#define _Z80_TFM_H_ -- --extern const u8 z80_tfm[0x69D]; -- --#endif // _Z80_TFM_H_ -+#ifndef _Z80_TFM_H_ -+#define _Z80_TFM_H_ -+ -+extern const u8 z80_tfm[0x69D]; -+ -+#endif // _Z80_TFM_H_ -diff --git a/src/z80_xgm.h b/src/z80_xgm.h -index 167307c..49364d2 100644 ---- a/src/z80_xgm.h -+++ b/src/z80_xgm.h -@@ -1,6 +1,6 @@ --#ifndef _Z80_XGM_H_ --#define _Z80_XGM_H_ -- --extern const u8 z80_xgm[0x1700]; -- --#endif // _Z80_XGM_H_ -+#ifndef _Z80_XGM_H_ -+#define _Z80_XGM_H_ -+ -+extern const u8 z80_xgm[0x1700]; -+ -+#endif // _Z80_XGM_H_ -diff --git a/tools/rescomp/inc/tools.h b/tools/rescomp/inc/tools.h -index 320fd16..20ef97e 100644 ---- a/tools/rescomp/inc/tools.h -+++ b/tools/rescomp/inc/tools.h -@@ -1,6 +1,11 @@ - #ifndef _TOOLS_H_ - #define _TOOLS_H_ - -+#if __linux -+#define stricmp strcasecmp -+#define strnicmp strncasecmp -+#define strupr toupper -+#endif - - #define FALSE 0 - #define TRUE 1 -diff --git a/tools/rescomp/src/tools.c b/tools/rescomp/src/tools.c -index 8160f36..c94dbcf 100644 ---- a/tools/rescomp/src/tools.c -+++ b/tools/rescomp/src/tools.c -@@ -797,7 +797,7 @@ static int appack(char* fin, char* fout) - strcat(cmd, "\" \""); - strcat(cmd, fout); - strcat(cmd, "\""); -- strcat(cmd, " -s"); -+ //strcat(cmd, " -s"); - - printf("Executing %s\n", cmd); - +@@ -25,6 +25,8 @@ BINTOS= $(BIN)/bintos + RESCOMP= $(JAVA) -jar $(BIN)/rescomp.jar + MKDIR= $(BIN)/mkdir + ++include $(GENDEV)/sgdk/mkfiles/makefile.vars ++ + SRC_C= $(wildcard *.c) + SRC_C+= $(wildcard $(SRC)/*.c) + SRC_S= $(wildcard *.s) +diff --git a/tools/appack/makefile.elf b/tools/appack/makefile.elf +index 63864f9..2826b2f 100644 +--- a/tools/appack/makefile.elf ++++ b/tools/appack/makefile.elf +@@ -12,7 +12,12 @@ objects = appack.o + + cflags = -Wall -O2 -s + ldflags = $(cflags) +-incdir = ../lib/elf ++include ./makefile.vars ++ifeq ($(osBits), 32) ++ incdir = ./lib/elf ++else ++ incdir = ./lib/elf64 ++endif + libs = $(incdir)/aplib.a + + .PHONY: all clean From 510cb338477e91478fcc00f8bb827718a7b5deb7 Mon Sep 17 00:00:00 2001 From: Matt Kubilus Date: Fri, 26 Jul 2019 19:40:12 -0400 Subject: [PATCH 02/18] Update packages in travis --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index a8f6171..c7acbeb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,9 +7,10 @@ branches: - /^\d+\.\d+(\.\d+)?(-\S*)?$/ addons: apt: + update: true packages: - texinfo - - openjdk-8-jdk + - openjdk-8-jdk-headless - dos2unix - g++ cache: From 44fdb98c63a0c1388a307dba54a399079e6d0587 Mon Sep 17 00:00:00 2001 From: Matt Kubilus Date: Fri, 26 Jul 2019 21:04:59 -0400 Subject: [PATCH 03/18] Add circleci --- .circleci/config.yml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 .circleci/config.yml diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 0000000..829e1f9 --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,20 @@ +version: 2 +jobs: + build: + docker: + - image: ubuntu:bionic + + steps: + - checkout + + - run: + name: build toolchain + command: make toolchain_build + + - run: + name: build tools + command: make tools_build + + - run: + name: build SGDK + command: sgdk_build From 0468f8cc08fee46fbcfdff697abbca46d786586d Mon Sep 17 00:00:00 2001 From: Matt Kubilus Date: Fri, 26 Jul 2019 21:06:55 -0400 Subject: [PATCH 04/18] Kick it --- .circleci/config.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 829e1f9..0365d57 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -4,6 +4,7 @@ jobs: docker: - image: ubuntu:bionic + steps: - checkout From b64d149accd1762617a8ce57e870d95bd190b384 Mon Sep 17 00:00:00 2001 From: Matt Kubilus Date: Fri, 26 Jul 2019 21:07:55 -0400 Subject: [PATCH 05/18] Fix spacing --- .circleci/config.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 0365d57..da7afdb 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -16,6 +16,6 @@ jobs: name: build tools command: make tools_build - - run: - name: build SGDK + - run: + name: build SGDK command: sgdk_build From 1c2d217fd3c0eba7b14bf8bf7936188ada64c0d3 Mon Sep 17 00:00:00 2001 From: Matt Kubilus Date: Fri, 26 Jul 2019 21:09:44 -0400 Subject: [PATCH 06/18] Fix CI --- .circleci/config.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index da7afdb..46ad501 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -8,6 +8,12 @@ jobs: steps: - checkout + - run: + name: Setup prereqs + command: | + apt-get update + apt-get install -y build-essential wget unzip unrar-free texinfo git openjdk-8-jdk dos2unix + - run: name: build toolchain command: make toolchain_build From acd2485575f36a19ed78b4e7279d5881052a3bcd Mon Sep 17 00:00:00 2001 From: Matt Kubilus Date: Fri, 26 Jul 2019 21:18:53 -0400 Subject: [PATCH 07/18] Update CI --- .circleci/config.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 46ad501..c87306e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -4,7 +4,9 @@ jobs: docker: - image: ubuntu:bionic - + environment: + - DEBIAN_FRONTEND=noninteractive + steps: - checkout @@ -12,7 +14,7 @@ jobs: name: Setup prereqs command: | apt-get update - apt-get install -y build-essential wget unzip unrar-free texinfo git openjdk-8-jdk dos2unix + apt-get install -y build-essential wget unzip unrar-free texinfo git openjdk-8-jdk-headless dos2unix - run: name: build toolchain From c63555f3421b84a9cadc70a12b202b2bfa73b95f Mon Sep 17 00:00:00 2001 From: Matt Kubilus Date: Sat, 27 Jul 2019 11:19:35 -0400 Subject: [PATCH 08/18] Update CI --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index c87306e..c34617c 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -26,4 +26,4 @@ jobs: - run: name: build SGDK - command: sgdk_build + command: make sgdk_build From 3d0265916cbaec12edc5dca83c9411b75930c6ae Mon Sep 17 00:00:00 2001 From: Matt Kubilus Date: Sat, 27 Jul 2019 12:43:11 -0400 Subject: [PATCH 09/18] Attempt to setup releases --- .circleci/config.yml | 45 ++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 41 insertions(+), 4 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index c34617c..0f5c6a0 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -9,21 +9,58 @@ jobs: steps: - checkout - - run: name: Setup prereqs command: | apt-get update apt-get install -y build-essential wget unzip unrar-free texinfo git openjdk-8-jdk-headless dos2unix - - run: name: build toolchain command: make toolchain_build - - run: name: build tools command: make tools_build - - run: name: build SGDK command: make sgdk_build + - run: + name: build samples + command: | + export GENDEV=`pwd`/build + make sgdk_samples + - persist_to_workspace: + root: build + paths: + - * + # - gendev_*.txz + # - gendev_*_all.deb + + release: + steps: + - attach_workspace: + at: ./build + - run: + name: Create release + command: make release + - run: + name: Upload release bins + command: | + REL_URL=$(curl -H "Authorization: token ${GITHUB_TOKEN}" https://api.github.com/repos/kubilus1/gendev/releases/tags/0.0.0 | jq -r '.upload_url' | sed -e 's/{?name,label}/?name=/g') + for PKG in $(ls ./dist/*); do + PKG_NAME=$(basename $PKG) + curl -vvvv -XPOST --data-binary @${PKG} -H "Content-Type: application/octet-stream" -H "Authorization: token ${GITHUB_TOKEN}" ${REL_URL}${PKG_NAME} + done + +workflows: + version: 2 + jobs: + - build + - release + requires: + - build + filters: + tags: + only: /.*/ + branches: + only: master + From ced8428922c6abf2892f679beff459343204455c Mon Sep 17 00:00:00 2001 From: Matt Kubilus Date: Sat, 27 Jul 2019 12:52:27 -0400 Subject: [PATCH 10/18] Attempt to setup releases --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 0f5c6a0..4b53a97 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -31,7 +31,7 @@ jobs: - persist_to_workspace: root: build paths: - - * + - '*' # - gendev_*.txz # - gendev_*_all.deb From fc8ed3fe37e7604ded97f4a9d8f96cd714d98c0a Mon Sep 17 00:00:00 2001 From: Matt Kubilus Date: Sat, 27 Jul 2019 12:53:07 -0400 Subject: [PATCH 11/18] Attempt to setup releases --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 4b53a97..95ea682 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -55,7 +55,7 @@ workflows: version: 2 jobs: - build - - release + - release: requires: - build filters: From 3913da5b1ddeec9a687e0cca9f85824c9e7da3e9 Mon Sep 17 00:00:00 2001 From: Matt Kubilus Date: Sat, 27 Jul 2019 12:54:41 -0400 Subject: [PATCH 12/18] Attempt to setup releases --- .circleci/config.yml | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 95ea682..bf3de2e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -53,14 +53,15 @@ jobs: workflows: version: 2 - jobs: - - build - - release: - requires: - - build - filters: - tags: - only: /.*/ - branches: - only: master + build_n_release: + jobs: + - build + - release: + requires: + - build + filters: + tags: + only: /.*/ + branches: + only: master From b17cee31b4685f91f88aaeb83bb1cdc1fff08082 Mon Sep 17 00:00:00 2001 From: Matt Kubilus Date: Sat, 27 Jul 2019 12:55:20 -0400 Subject: [PATCH 13/18] Attempt to setup releases --- .circleci/config.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index bf3de2e..50aca46 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -36,6 +36,9 @@ jobs: # - gendev_*_all.deb release: + docker: + - image: ubuntu:bionic + steps: - attach_workspace: at: ./build From 5ff0037e31e59c3301cd2636d71d0ef3831d5ae4 Mon Sep 17 00:00:00 2001 From: Matt Kubilus Date: Sat, 27 Jul 2019 16:26:13 -0400 Subject: [PATCH 14/18] Specify ver with patch --- sgdk/Makefile | 14 +++++++------- sgdk/files/{sgdk.diff => sgdk_v1.40.diff} | 0 2 files changed, 7 insertions(+), 7 deletions(-) rename sgdk/files/{sgdk.diff => sgdk_v1.40.diff} (100%) diff --git a/sgdk/Makefile b/sgdk/Makefile index 1369ba9..6aa53db 100644 --- a/sgdk/Makefile +++ b/sgdk/Makefile @@ -4,7 +4,7 @@ GENGCC_BIN=$(GENDEV)/bin SGDKDIR=$(CURDIR)/SGDK SAMPLESDIR=$(SGDKDIR)/sample -SGDKVER=v1.40 +SGDKVER=1.34 SGDKINSTALLDIR=$(GENDEV)/sgdk$(SGDKVER) all: tools $(SGDKDIR) $(SGDKDIR)/libmd.a @@ -18,17 +18,17 @@ tools: $(SGDKDIR) $(MAKE) -f ../../../files/Makefile.xgmtool && cp out/xgmtool $(GENDEV)/bin/. cp $(SGDKDIR)/bin/*.jar $(GENDEV)/bin/. -patch: - cd $(SGDKDIR) && git diff * > ../files/sgdk.diff +patch: $(SGDKDIR) + cd $(SGDKDIR) && git diff * > ../files/sgdk_$(SGDKVER).diff -prep: - cd $(SGDKDIR) && patch -u -p1 -l < ../files/sgdk.diff +prep: $(SGDKDIR) + cd $(SGDKDIR) && patch -u -p1 -l < ../files/sgdk_$(SGDKVER).diff $(SGDKDIR): git clone -b '$(SGDKVER)' --single-branch --depth 1 https://github.com/Stephane-D/SGDK.git - cd $(SGDKDIR) && find . -regextype posix-extended -regex '.*make(lib|file).*' -exec dos2unix {} \; && patch -u -p1 -l < ../files/sgdk.diff + #cd $(SGDKDIR) && find . -regextype posix-extended -regex '.*make(lib|file).*' -exec dos2unix {} \; -$(SGDKDIR)/libmd.a: $(SGDKDIR) +$(SGDKDIR)/libmd.a: prep cp -rf ../tools/files/applib/lib $(SGDKDIR)/tools/appack cd $(SGDKDIR) && ln -sf ../files/Makefile.sgdk_lib . cd $(SGDKDIR) && $(MAKE) -f Makefile.sgdk_lib diff --git a/sgdk/files/sgdk.diff b/sgdk/files/sgdk_v1.40.diff similarity index 100% rename from sgdk/files/sgdk.diff rename to sgdk/files/sgdk_v1.40.diff From 5fea1fa82909c6e5a823a485a59462f081682deb Mon Sep 17 00:00:00 2001 From: Matt Kubilus Date: Sat, 3 Aug 2019 08:48:37 -0400 Subject: [PATCH 15/18] Fix smaples and patch --- .travis.yml | 2 ++ sgdk/Makefile | 4 ++-- sgdk/files/sgdk_v1.40.diff | 19 ++++++++++++++++--- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index c7acbeb..d9fe045 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,3 +1,5 @@ +# Not using Travis anymore but keeping this for now. + dist: bionic language: c sudo: false diff --git a/sgdk/Makefile b/sgdk/Makefile index 6aa53db..0c8563f 100644 --- a/sgdk/Makefile +++ b/sgdk/Makefile @@ -4,7 +4,7 @@ GENGCC_BIN=$(GENDEV)/bin SGDKDIR=$(CURDIR)/SGDK SAMPLESDIR=$(SGDKDIR)/sample -SGDKVER=1.34 +SGDKVER=v1.40 SGDKINSTALLDIR=$(GENDEV)/sgdk$(SGDKVER) all: tools $(SGDKDIR) $(SGDKDIR)/libmd.a @@ -19,7 +19,7 @@ tools: $(SGDKDIR) cp $(SGDKDIR)/bin/*.jar $(GENDEV)/bin/. patch: $(SGDKDIR) - cd $(SGDKDIR) && git diff * > ../files/sgdk_$(SGDKVER).diff + cd $(SGDKDIR) && git diff . > ../files/sgdk_$(SGDKVER).diff prep: $(SGDKDIR) cd $(SGDKDIR) && patch -u -p1 -l < ../files/sgdk_$(SGDKVER).diff diff --git a/sgdk/files/sgdk_v1.40.diff b/sgdk/files/sgdk_v1.40.diff index 9934376..87bef59 100644 --- a/sgdk/files/sgdk_v1.40.diff +++ b/sgdk/files/sgdk_v1.40.diff @@ -5,18 +5,31 @@ index f12594d..d240b3f 100644 @@ -25,6 +25,8 @@ BINTOS= $(BIN)/bintos RESCOMP= $(JAVA) -jar $(BIN)/rescomp.jar MKDIR= $(BIN)/mkdir - + +include $(GENDEV)/sgdk/mkfiles/makefile.vars + SRC_C= $(wildcard *.c) SRC_C+= $(wildcard $(SRC)/*.c) SRC_S= $(wildcard *.s) +diff --git a/sample/xgmplayer/src/main.c b/sample/xgmplayer/src/main.c +index 5623e70..5c4e75f 100644 +--- a/sample/xgmplayer/src/main.c ++++ b/sample/xgmplayer/src/main.c +@@ -285,7 +285,7 @@ int main() + initBGScroll(); + + // init Sprite engine +- SPR_initEx(20, 80, 64); ++ SPR_initEx(80, 64); + + // prepare sprites for panning + YMPanSprites[0] = SPR_addSprite(&left_right, 32 + 0, 203, TILE_ATTR(PAL0, TRUE, FALSE, FALSE)); diff --git a/tools/appack/makefile.elf b/tools/appack/makefile.elf index 63864f9..2826b2f 100644 --- a/tools/appack/makefile.elf +++ b/tools/appack/makefile.elf @@ -12,7 +12,12 @@ objects = appack.o - + cflags = -Wall -O2 -s ldflags = $(cflags) -incdir = ../lib/elf @@ -27,5 +40,5 @@ index 63864f9..2826b2f 100644 + incdir = ./lib/elf64 +endif libs = $(incdir)/aplib.a - + .PHONY: all clean From 537c3a76a5f4f70efbdaa3eb8b2f7129313413e9 Mon Sep 17 00:00:00 2001 From: Matt Kubilus Date: Sat, 3 Aug 2019 09:40:40 -0400 Subject: [PATCH 16/18] Update patch --- sgdk/files/sgdk_v1.40.diff | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/sgdk/files/sgdk_v1.40.diff b/sgdk/files/sgdk_v1.40.diff index 87bef59..6bf3b59 100644 --- a/sgdk/files/sgdk_v1.40.diff +++ b/sgdk/files/sgdk_v1.40.diff @@ -3,14 +3,14 @@ index f12594d..d240b3f 100644 --- a/makefile.gen +++ b/makefile.gen @@ -25,6 +25,8 @@ BINTOS= $(BIN)/bintos - RESCOMP= $(JAVA) -jar $(BIN)/rescomp.jar - MKDIR= $(BIN)/mkdir - -+include $(GENDEV)/sgdk/mkfiles/makefile.vars -+ - SRC_C= $(wildcard *.c) - SRC_C+= $(wildcard $(SRC)/*.c) - SRC_S= $(wildcard *.s) + RESCOMP= $(JAVA) -jar $(BIN)/rescomp.jar + MKDIR= $(BIN)/mkdir + ++include $(GENDEV)/sgdk/mkfiles/makefile.vars ++ + SRC_C= $(wildcard *.c) + SRC_C+= $(wildcard $(SRC)/*.c) + SRC_S= $(wildcard *.s) diff --git a/sample/xgmplayer/src/main.c b/sample/xgmplayer/src/main.c index 5623e70..5c4e75f 100644 --- a/sample/xgmplayer/src/main.c From 106ca300501eb4b5da38c37ec3a4babf12a0d52a Mon Sep 17 00:00:00 2001 From: Matt Kubilus Date: Sat, 3 Aug 2019 09:40:52 -0400 Subject: [PATCH 17/18] Add .gitattributes --- sgdk/.gitattributes | 1 + 1 file changed, 1 insertion(+) create mode 100644 sgdk/.gitattributes diff --git a/sgdk/.gitattributes b/sgdk/.gitattributes new file mode 100644 index 0000000..1f8138b --- /dev/null +++ b/sgdk/.gitattributes @@ -0,0 +1 @@ +* -crlf From 007a60ab4441defebee0b35331ae7017805c1396 Mon Sep 17 00:00:00 2001 From: Matt Kubilus Date: Sat, 3 Aug 2019 15:39:59 -0400 Subject: [PATCH 18/18] Fix sample and Dockerfile --- Dockerfile | 44 ++++++++++++++++++++++++++++++++------ Makefile | 4 +++- README.md | 5 ++--- sgdk/Makefile | 1 - sgdk/files/sgdk_v1.40.diff | 4 ++-- 5 files changed, 44 insertions(+), 14 deletions(-) diff --git a/Dockerfile b/Dockerfile index 86ade9e..487bf90 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,15 +1,45 @@ -FROM ubuntu:18.04 +FROM ubuntu:bionic as build -WORKDIR /tmp +ENV DEBIAN_FRONTEND noninteractive + +ENV GENDEV /opt/gendev RUN apt-get update && \ - apt-get install -y build-essential wget unzip unrar-free texinfo git openjdk-8-jdk dos2unix && \ + apt-get install -y \ + build-essential \ + wget \ + unzip \ + unrar-free \ + texinfo \ + git \ + openjdk-8-jdk-headless && \ apt-get clean # To download gcc 6.3 with wget. We must provide a password with '@' in. -RUN echo ftp_user=anonymous > ~/.wgetrc -RUN echo ftp_password=dfdf@dfdf.com >> ~/.wgetrc +#RUN echo ftp_user=anonymous > ~/.wgetrc +#RUN echo ftp_password=dfdf@dfdf.com >> ~/.wgetrc + +#RUN bash -c "git clone https://github.com/kubilus1/gendev.git && cd gendev && make && rm -rf /tmp/*" +WORKDIR /work +COPY tools /work/tools/ +COPY Makefile /work/ +COPY sgdk /work/sgdk/ +COPY toolchain /work/toolchain/ +RUN make +RUN make install + +FROM ubuntu:bionic +RUN apt-get update && \ + apt-get install -y \ + openjdk-8-jre-headless \ + build-essential \ + make && \ + apt-get clean + +ENV GENDEV /opt/gendev +COPY --from=build /opt/gendev $GENDEV +ENV PATH $GENDEV/bin:$PATH -RUN bash -c "git clone https://github.com/kubilus1/gendev.git && cd gendev && make && rm -rf /tmp/*" +WORKDIR /src -CMD /bin/bash +ENTRYPOINT make -f $GENDEV/sgdk/mkfiles/makefile.gen diff --git a/Makefile b/Makefile index 51781a9..324be8f 100644 --- a/Makefile +++ b/Makefile @@ -47,13 +47,15 @@ tools_clean: sgdk_samples: cd sgdk && $(MAKE) sample_clean samples -install: +$(GENDEV): if [ -w /opt ]; then \ mkdir -p $(GENDEV); \ else \ $(SUDO) mkdir -p $@; \ $(SUDO) chown $(ORIG_USER):$(ORIG_USER) $@; \ fi + +install: $(GENDEV) echo "export GENDEV=$(GENDEV)" > ~/.gendev echo "export PATH=\$$GENDEV/bin:\$$PATH" >> ~/.gendev #$(SUDO) chmod 777 $@ diff --git a/README.md b/README.md index d5a7333..df0ee0f 100644 --- a/README.md +++ b/README.md @@ -55,7 +55,7 @@ PROJECT STRUCTURE TOOLCHAIN BUILDING ================== -The toolchain is now setup with Travis-CI for continuous integration. This +The toolchain is now setup with CircleCI for continuous integration. This should ease porting and allow better validation of incoming patches. You may decide to build the full toolchain by making sure you have the following @@ -66,7 +66,6 @@ package installed: - curl - wget - unzip - - dos2unix and then: ``` @@ -75,7 +74,7 @@ $ make ``` ... and wait about 45 minutes or so. -The .travis-ci.yml script is a good place to look to see how the individual +The .circleci/config.yml script is a good place to look to see how the individual build stages are executed. diff --git a/sgdk/Makefile b/sgdk/Makefile index 0c8563f..233b812 100644 --- a/sgdk/Makefile +++ b/sgdk/Makefile @@ -26,7 +26,6 @@ prep: $(SGDKDIR) $(SGDKDIR): git clone -b '$(SGDKVER)' --single-branch --depth 1 https://github.com/Stephane-D/SGDK.git - #cd $(SGDKDIR) && find . -regextype posix-extended -regex '.*make(lib|file).*' -exec dos2unix {} \; $(SGDKDIR)/libmd.a: prep cp -rf ../tools/files/applib/lib $(SGDKDIR)/tools/appack diff --git a/sgdk/files/sgdk_v1.40.diff b/sgdk/files/sgdk_v1.40.diff index 6bf3b59..224d274 100644 --- a/sgdk/files/sgdk_v1.40.diff +++ b/sgdk/files/sgdk_v1.40.diff @@ -12,7 +12,7 @@ index f12594d..d240b3f 100644 SRC_C+= $(wildcard $(SRC)/*.c) SRC_S= $(wildcard *.s) diff --git a/sample/xgmplayer/src/main.c b/sample/xgmplayer/src/main.c -index 5623e70..5c4e75f 100644 +index 5623e70..f23590b 100644 --- a/sample/xgmplayer/src/main.c +++ b/sample/xgmplayer/src/main.c @@ -285,7 +285,7 @@ int main() @@ -20,7 +20,7 @@ index 5623e70..5c4e75f 100644 // init Sprite engine - SPR_initEx(20, 80, 64); -+ SPR_initEx(80, 64); ++ SPR_initEx(0, 0); // prepare sprites for panning YMPanSprites[0] = SPR_addSprite(&left_right, 32 + 0, 203, TILE_ATTR(PAL0, TRUE, FALSE, FALSE));