forked from Telodendria/Cytoplasm
Compare commits
8 commits
8987802437
...
4f316ff7b3
Author | SHA1 | Date | |
---|---|---|---|
4f316ff7b3 | |||
6827d4fc39 | |||
63bd879101 | |||
f7c51ee019 | |||
af4a142261 | |||
10c8784f25 | |||
4a21567bc5 | |||
ff094b50f2 |
5 changed files with 97 additions and 26 deletions
18
.forgejo/workflows/compile.yaml
Normal file
18
.forgejo/workflows/compile.yaml
Normal file
|
@ -0,0 +1,18 @@
|
|||
name: Compile Cytoplasm
|
||||
run-name: Compile Cytoplasm on ${{ forgejo.actor }}
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
"Compile Cytoplasm":
|
||||
strategy:
|
||||
matrix:
|
||||
os: [alpine]
|
||||
arch: [aarch64]
|
||||
runs-on: ["${{ matrix.os }}", "${{ matrix.arch }}"]
|
||||
steps:
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v4
|
||||
- name: Configure Cytoplasm
|
||||
run: ./configure
|
||||
- name: Build Cytoplasm
|
||||
run: make
|
|
@ -1,25 +0,0 @@
|
|||
name: Compile Cytoplasm
|
||||
run-name: Compile Cytoplasm on ${{ gitea.actor }}
|
||||
on: [push]
|
||||
|
||||
jobs:
|
||||
"Compile Cytoplasm":
|
||||
strategy:
|
||||
matrix:
|
||||
os: [debian-v12.4, alpine-v3.19, openbsd-v7.4, freebsd-v14.0, netbsd-v9.3]
|
||||
arch: [x86, x86_64]
|
||||
exclude:
|
||||
# 32-bit OpenBSD does not behave well in QEMU. Even when using
|
||||
# QEMU to emulate i386, it utilizes 100% of its CPU core and is
|
||||
# still extremely sluggish. Thus, we don't have a working 32-bit
|
||||
# OpenBSD runner, so exclude it from the matrix configuration.
|
||||
- os: openbsd-v7.4
|
||||
arch: x86
|
||||
runs-on: ["${{ matrix.os }}", "${{ matrix.arch }}"]
|
||||
steps:
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v3
|
||||
- name: Configure Cytoplasm
|
||||
run: ./configure
|
||||
- name: Build Cytoplasm
|
||||
run: make
|
2
configure
vendored
2
configure
vendored
|
@ -37,7 +37,7 @@ case "$(uname)" in
|
|||
# These systems typically use GCC.
|
||||
SCRIPT_ARGS="${SCRIPT_ARGS} --cc=gcc"
|
||||
;;
|
||||
OpenBSD|FreeBSD)
|
||||
OpenBSD|FreeBSD|Darwin)
|
||||
# These systems typically use Clang.
|
||||
SCRIPT_ARGS="${SCRIPT_ARGS} --cc=clang"
|
||||
;;
|
||||
|
|
69
include/Cytoplasm/Platform.h
Normal file
69
include/Cytoplasm/Platform.h
Normal file
|
@ -0,0 +1,69 @@
|
|||
/*
|
||||
* Copyright (C) 2022-2024 Jordan Bancino <@jordan:bancino.net>
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person
|
||||
* obtaining a copy of this software and associated documentation files
|
||||
* (the "Software"), to deal in the Software without restriction,
|
||||
* including without limitation the rights to use, copy, modify, merge,
|
||||
* publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
* and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
||||
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
#ifndef CYTOPLASM_PLATFORM_H
|
||||
#define CYTOPLASM_PLATFORM_H
|
||||
|
||||
/***
|
||||
* @Nm Platform
|
||||
* @Nd A simple macro header that determines what platform the application
|
||||
* is being built for.
|
||||
* @Dd September 21, 2024
|
||||
*/
|
||||
|
||||
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__)
|
||||
#define PLATFORM_WINDOWS
|
||||
|
||||
#ifdef _WIN64
|
||||
#define PLATFORM_WIN64
|
||||
#else
|
||||
#define PLATFORM_WIN32
|
||||
#endif
|
||||
#elif __APPLE__
|
||||
#define PLATFORM_DARWIN
|
||||
|
||||
#include <TargetConditionals.h>
|
||||
#if TARGET_IPHONE_SIMULATOR
|
||||
#define PLATFORM_IPHONE
|
||||
#elif TARGET_OS_MACCATALYST
|
||||
#define PLATFORM_CATALYST
|
||||
#elif TARGET_OS_IPHONE
|
||||
#define PLATFORM_IPHONE
|
||||
#elif TARGET_OS_MAC
|
||||
#define PLATFORM_MAC
|
||||
#else
|
||||
# error "Unknown Apple platform"
|
||||
#endif
|
||||
#elif __ANDROID__
|
||||
#define PLATFORM_ANDROID
|
||||
#elif __linux__
|
||||
#define PLATFORM_LINUX
|
||||
#elif __unix__
|
||||
#define PLATFORM_UNIX
|
||||
#elif defined(_POSIX_VERSION)
|
||||
#define PLATFORM_POSIX
|
||||
#else
|
||||
# error "Unknown compiler"
|
||||
#endif
|
||||
|
||||
#endif /* CYTOPLASM_PLATFORM_H */
|
|
@ -24,6 +24,7 @@
|
|||
#include <Util.h>
|
||||
|
||||
#include <Memory.h>
|
||||
#include <Platform.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -89,6 +90,10 @@ UtilTsMillis(void)
|
|||
return ts;
|
||||
}
|
||||
|
||||
#ifdef PLATFORM_DARWIN
|
||||
#define st_mtim st_mtimespec
|
||||
#endif
|
||||
|
||||
uint64_t
|
||||
UtilLastModified(char *path)
|
||||
{
|
||||
|
@ -105,6 +110,10 @@ UtilLastModified(char *path)
|
|||
return ts;
|
||||
}
|
||||
|
||||
#ifdef PLATFORM_DARWIN
|
||||
#undef st_mtim
|
||||
#endif
|
||||
|
||||
int
|
||||
UtilMkdir(const char *dir, const mode_t mode)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue