Add support for BSD

This commit is contained in:
Jan200101 2020-07-17 20:05:33 +02:00
parent 6b47859f75
commit 9cf199682b
No known key found for this signature in database
GPG key ID: 5B71B1D78B882E05
12 changed files with 38 additions and 11 deletions

View file

@ -176,7 +176,7 @@ endif
endif
# Make tools if out of date
DUMMY != make -s -C tools >&2 || echo FAIL
DUMMY != $(MAKE) -s -C tools >&2 || echo FAIL
ifeq ($(DUMMY),FAIL)
$(error Failed to build tools)
endif

View file

@ -152,9 +152,15 @@ def main():
)
sys.exit(1)
make = "make"
for path in os.environ["PATH"].split(os.pathsep):
if os.path.isfile(os.path.join(path, "gmake")):
make = "gmake"
# Make sure tools exist
subprocess.check_call(
["make", "-s", "-C", "tools/", "n64graphics", "skyconv", "mio0", "aifc_decode"]
[make, "-s", "-C", "tools/", "n64graphics", "skyconv", "mio0", "aifc_decode"]
)
# Go through the assets in roughly alphabetical order (but assets in the same

View file

@ -1,4 +1,6 @@
#if defined(__linux__) && !defined(TARGET_WEB)
#include "../compat.h"
#if (defined(__linux__) || defined(__BSD__)) && !defined(TARGET_WEB)
/*
Simple sound playback using ALSA API and libasound.
Dependencies: libasound, alsa

View file

@ -1,7 +1,9 @@
#ifndef AUDIO_ALSA_H
#define AUDIO_ALSA_H
#ifdef __linux__
#include "../compat.h"
#if defined(__linux__) || defined(__BSD__)
extern struct AudioAPI audio_alsa;
#define HAVE_ALSA 1
#else

View file

@ -1,4 +1,6 @@
#ifdef __linux__
#include "../compat.h"
#if defined(__linux__) || defined(__BSD__)
#include <stdio.h>
#include <stdbool.h>

View file

@ -1,7 +1,9 @@
#ifndef AUDIO_PULSE_H
#define AUDIO_PULSE_H
#ifdef __linux__
#include "../compat.h"
#if defined(__linux__) || defined(__BSD__)
extern struct AudioAPI audio_pulse;
#define HAVE_PULSE_AUDIO 1
#else

8
src/pc/compat.h Normal file
View file

@ -0,0 +1,8 @@
#ifndef COMPAT_H
#define COMPAT_H value
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
#define __BSD__
#endif
#endif

View file

@ -1,4 +1,4 @@
#if !defined(__MINGW32__) && !defined(TARGET_WEB)
#if !defined(__MINGW32__) && !defined(__BSD__) && !defined(TARGET_WEB)
// See LICENSE for license
#define _XOPEN_SOURCE 600

View file

@ -1,4 +1,6 @@
#ifdef __linux__
#include "../compat.h"
#if defined(__linux__) || defined(__BSD__)
#include <stdlib.h>
#include <stdio.h>
#include <stdbool.h>

View file

@ -1,4 +1,6 @@
#if !defined(__linux__) && defined(ENABLE_OPENGL)
#include "../compat.h"
#if !defined(__linux__) && !defined(__BSD__) && defined(ENABLE_OPENGL)
#ifdef __MINGW32__
#define FOR_WINDOWS 1

View file

@ -29,6 +29,8 @@
#include "configfile.h"
#include "compat.h"
#define CONFIG_FILE "sm64config.txt"
OSMesg D_80339BEC;
@ -158,7 +160,7 @@ void main_func(void) {
wm_api = &gfx_dxgi_api;
#elif defined(ENABLE_OPENGL)
rendering_api = &gfx_opengl_api;
#if defined(__linux__)
#if defined(__linux__) || defined(__BSD__)
wm_api = &gfx_glx;
#else
wm_api = &gfx_sdl;

View file

@ -23,7 +23,6 @@ SOFTWARE.
*/
#include "exoquant.h"
#include <malloc.h>
#include <math.h>
#include <stdlib.h>
#include <stdio.h>