Okay, if you want to work on N64 homebrew, you need decent tools. You need a compiler, and some libraries. I just finished making an up-to-date toolchain, using it to compile a few libraries and scummvm as a test.
This is the big one - the toolchain. This is gcc 4.4.2 with bintools 2.20. It's compiled for x86 under Xubuntu 9.04, but it should work on any reasonably recent distro in 32 or 64 bits. It has a few libraries already in the SDK directory - namely, the ones needed to compile scummvm.
n64dev-20100119.7zIt's organize like most of my toolchains - copy the n64dev directory to wherever you want it, and set a few envvars before using it.
export N64DEV=/home/jlfenton/Tools/n64dev
export PATH=$N64DEV/mips64/bin:$N64DEV/bin:$PATH
export LD_LIBRARY_PATH=$N64DEV/mips64/bin
Obviously, you'd change the path to n64dev to wherever you copied it. Here's the source for the libraries included so far.
libn64-20100119.ziptremor-20100119.zipzlib-20100119.zipAs I add more libraries, they'll get added to this post. The normal way to compile these is to do
make
make install
If there is a Makefile.n64 file present, then do
make -f Makefile.n64
make install -f Makefile.n64
If you wish to build your own toolchain, here's the makefile I made to do that. It's derived from the makefile used to build the toolchain for the Dreamcast.
make-tools-20100119.zipNote: each library will have it's own license. Please abide by them. For example, the libn64 library is GPL v3. You cannot use it for closed source programs. I can use it for the menu because, like most other code here, the menu is MIT licensed, which is compatible with the GPL license. If you aren't sure what is or is not compatible, consult the GNU page on the matter.
http://www.gnu.org/licenses/license-list.htmlIf you want an example of making a major app with this, look at scummvm. First checkout the latest code from their repo.
svn co https://scummvm.svn.sourceforge.net/svnroot/scummvm scummvm
You'll find most of the N64 code in "backends/platforms/n64". I changed the Makefile just a smidgen to work with the layout of my toolchain. The makefile I used to compile scummvm is:
TOOLPATH = $(N64DEV)/mips64
LIBN64PATH = $(TOOLPATH)/sdk
GCCN64PREFIX = $(TOOLPATH)/bin/
srcdir = ../../..
VPATH = $(srcdir)
CC = $(GCCN64PREFIX)gcc
CXX = $(GCCN64PREFIX)g++
AS = $(GCCN64PREFIX)as
LD = $(GCCN64PREFIX)g++
OBJCOPY = $(GCCN64PREFIX)objcopy
AR = $(GCCN64PREFIX)ar cru
RANLIB = $(GCCN64PREFIX)ranlib
DEFINES += -D__N64__ -DLIMIT_FPS -DNONSTANDARD_PORT -DDISABLE_DEFAULT_SAVEFILEMANAGER -DDISABLE_TEXT_CONSOLE \
-DDISABLE_COMMAND_LINE -DDISABLE_FANCY_THEMES -DDISABLE_DOSBOX_OPL -DENABLE_VKEYBD -DUSE_ZLIB
LIBS += -lpakfs -lframfs -ln64 -ln64utils -lromfs
DEFINES += -D_ENABLE_DEBUG_
#DEFINES += -D_NORMAL_N64_DELAY_
USE_LIBMAD=0
USE_LIBOGG=1
ifeq ($(USE_LIBMAD),1)
DEFINES += -DUSE_MAD
LIBS += -lmad
endif
ifeq ($(USE_LIBOGG), 1)
DEFINES += -DUSE_VORBIS -DUSE_TREMOR
LIBS += -lvorbisidec
endif
LIBS += -lm -lstdc++ -lc -lgcc -lz -lnosys
CXXFLAGS = -g -O2 -fomit-frame-pointer -march=vr4300 -mtune=vr4300 -mno-extern-sdata -fno-rtti -fno-exceptions \
-Wno-multichar -Wshadow -I$(LIBN64PATH)/include -I$(TOOLPATH)/include -I./ -I$(srcdir) -I$(srcdir)/engines
LDFLAGS = -g -march=vr4300 -mtune=vr4300 -nodefaultlibs -nostartfiles -mno-crt0 \
-L$(LIBN64PATH)/lib -L$(TOOLPATH)/lib $(LIBS) -T $(TOOLPATH)/lib/n64ld_cpp.x -Xlinker -Map -Xlinker scummvm.map
TARGET = scummvm
DEPDIR = .deps
CXX_UPDATE_DEP_FLAG = -Wp,-MMD,"$(*D)/$(DEPDIR)/$(*F).d",-MQ,"$@",-MP
MKDIR = mkdir -p
RM = rm -f
RM_REC = rm -rf
VERBOSE_BUILD=0
HAVE_GCC3=1
DISABLE_SCALERS=1
DISABLE_HQ_SCALER=1
USE_MT32EMU=0
USE_RGB_COLOR=0
ENABLED=STATIC_PLUGIN
#ENABLE_SCUMM = $(ENABLED)
#ENABLE_SCUMM_7_8 = $(ENABLED)
#ENABLE_HE = $(ENABLED)
#ENABLE_AGI = $(ENABLED)
#ENABLE_AGOS = $(ENABLED)
#ENABLE_AGOS2 = $(ENABLED)
#ENABLE_CINE = $(ENABLED)
#ENABLE_CRUISE = $(ENABLED)
#ENABLE_DRACI = $(ENABLED)
#ENABLE_DRASCULA = $(ENABLED)
#ENABLE_GOB = $(ENABLED)
#ENABLE_GROOVIE = $(ENABLED)
#ENABLE_GROOVIE2 = $(ENABLED)
#ENABLE_IHNM = $(ENABLED)
#ENABLE_KYRA = $(ENABLED)
#ENABLE_LOL = $(ENABLED)
ENABLE_LURE = $(ENABLED)
#ENABLE_M4 = $(ENABLED)
#ENABLE_MADE = $(ENABLED)
#ENABLE_PARALLACTION = $(ENABLED)
#ENABLE_QUEEN = $(ENABLED)
#ENABLE_SAGA = $(ENABLED)
#ENABLE_SAGA2 = $(ENABLED)
#ENABLE_SCI = $(ENABLED)
#ENABLE_SCI32 = $(ENABLED)
ENABLE_SKY = $(ENABLED)
#ENABLE_SWORD1 = $(ENABLED)
#ENABLE_SWORD2 = $(ENABLED)
#ENABLE_TEENAGENT = $(ENABLED)
#ENABLE_TINSEL = $(ENABLED)
#ENABLE_TOUCHE = $(ENABLED)
#ENABLE_TUCKER = $(ENABLED)
OBJS := nintendo64.o osys_n64_base.o osys_n64_events.o osys_n64_utilities.o pakfs_save_manager.o framfs_save_manager.o
include $(srcdir)/Makefile.common
MODULE_DIRS += ./
all: $(TARGET).v64
$(TARGET).v64: $(TARGET).bin ROMFS.img bootcode
cat bootcode $(TARGET).bin ROMFS.img > $(TARGET).v64
./pad_rom.sh
ROMFS.img:
genromfs -f ./ROMFS.img -d ./ROMFS -V romtest
$(TARGET).elf: $(OBJS)
$(LD) -o $(TARGET).elf $(OBJS) $(LDFLAGS)
$(TARGET).bin : $(TARGET).elf
$(OBJCOPY) $(TARGET).elf $(TARGET).bin -O binary
spotless : distclean
$(RM) *.bin *.elf *.v64 *.img *.bak *.tmp *.map
The finished result ran fine on my N64 Myth. If you want to learn more about scummvm, visit their web page at:
http://www.scummvm.org/