Skip to content

Commit

Permalink
fix: reuse compliance and build improvements
Browse files Browse the repository at this point in the history
more reuse info on builtins

small improvements on build

saved leftover experiment embedding glfw and glew

ci: try vt action fix
  • Loading branch information
jaromil committed Dec 18, 2024
1 parent 9b08cf4 commit ab974b6
Show file tree
Hide file tree
Showing 10 changed files with 121 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ jobs:
uses: crazy-max/ghaction-virustotal@v4
with:
vt_api_key: ${{ secrets.VIRUSTOTAL_API_KEY }}
update_release: true
update_release_body: true
files: |
cjit-bin/release-win-native-x86_64/*
cjit-bin/release-osx-native/*
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
cjit
*.o
src/embed*
.build_done*
3 changes: 3 additions & 0 deletions GNUmakefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# SPDX-FileCopyrightText: 2024 Dyne.org
# SPDX-License-Identifier: GPL-3.0-or-later

# Copyright (C) 2024 Dyne.org Foundation
#
# This source code is free software; you can redistribute it and/or
Expand Down
16 changes: 16 additions & 0 deletions LICENSES/MIT-0.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
MIT No Attribution

Copyright <YEAR> <COPYRIGHT HOLDER>

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.

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.
40 changes: 38 additions & 2 deletions REUSE.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,13 @@ SPDX-PackageSupplier = "Denis Roio <[email protected]>"
SPDX-PackageDownloadLocation = "https://github.com/dyne/cjit"

[[annotations]]
path = ["src/**", "**"]
path = ["src/**", "build/**", "test/**", "examples/**", "REUSE.toml"]
precedence = "aggregate"
SPDX-FileCopyrightText = "2024 Dyne.org foundation"
SPDX-License-Identifier = "GPL-3.0-or-later"

[[annotations]]
path = [".*", ".github/**"]
precedence = "aggregate"
SPDX-FileCopyrightText = "2024 Dyne.org foundation"
SPDX-License-Identifier = "GPL-3.0-or-later"
Expand All @@ -24,9 +30,39 @@ SPDX-License-Identifier = "LGPL-2.1-or-later"
[[annotations]]
path = "lib/contrib_headers/dmon.h"
precedence = "aggregate"
SPDX-FileCopyrightText = " 2019-2023, Sepehr Taghdisian"
SPDX-FileCopyrightText = " 2019-2023 Sepehr Taghdisian"
SPDX-License-Identifier = "BSD-2-Clause"

[[annotations]]
path = "lib/contrib_headers/miniaudio.h"
precedence = "aggregate"
SPDX-FileCopyrightText = " 2023 David Reid"
SPDX-License-Identifier = "MIT-0"

[[annotations]]
path = "lib/contrib_headers/nuklear.h"
precedence = "aggregate"
SPDX-FileCopyrightText = "2017 Micha Mettke"
SPDX-License-Identifier = "MIT-0"

[[annotations]]
path = "lib/stb/**"
precedence = "aggregate"
SPDX-FileCopyrightText = " 2009-2021 Sean Barrett"
SPDX-License-Identifier = "MIT-0"

[[annotations]]
path = "lib/win32ports/**"
precedence = "aggregate"
SPDX-FileCopyrightText = " 2019 win32ports"
SPDX-License-Identifier = "MIT-0"

[[annotations]]
path = "lib/contrib_headers/termbox2.h"
precedence = "aggregate"
SPDX-FileCopyrightText = " 2010-2020 nsf, 2015-2024 Adam Saponara"
SPDX-License-Identifier = "MIT-0"

[[annotations]]
path = ["docs/**", "**.md"]
precedence = "aggregate"
Expand Down
21 changes: 21 additions & 0 deletions build/deps.mk
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,24 @@ lib/tinycc/libtcc.a lib/tinycc/libtcc1.a:
clean:
${MAKE} -C lib/tinycc clean distclean
${MAKE} -C src clean

# UNUSED EXPERIMENTS:
lib/glfw/src/libglfw3.a:
cd lib/glfw \
&& cmake .
-DGLFW_BUILD_EXAMPLES=NO \
-DGLFW_BUILD_TESTS=NO \
-DGLFW_BUILD_DOCS=NO
${MAKE} -C lib/glfw
cp lib/glfw/deps/linmath.h lib/glfw/include/GLFW/
cp lib/glfw/deps/tinycthread.h lib/glfw/include/GLFW/
cp lib/glfw/deps/nuklear_glfw* lib/glfw/include/GLFW/
cp -r lib/glfw/deps/glad lib/glfw/include/GLFW/

lib/glew/lib/libGLEW.a:
${MAKE} -C lib/glew/auto
${MAKE} -C lib/glew

# ${MAKE} -C lib/glfw clean
# ${MAKE} -C lib/glew/auto clean
# ${MAKE} -C lib/glew clean
28 changes: 28 additions & 0 deletions build/export-symbols.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env zsh
#
# extract external symbols from library files on linux

lib=$1
[ -r "$lib" ] || {
>&2 echo "Lib not found: $lib"
exit 1
}

syms=`nm -WUg ${lib} | awk '$2 ~ T {if($3)print $3}' | grep -v '^_' | grep -v '.0$'`
name=`basename $lib | sed 's/\./_/g' | sed 's/-/_/g' | sed 's/_a$//g'`
cat <<EOF > src/${name}.c
// Generated by cjit/build/export-symbols.sh
// `date`
#include <libtcc.h>
// TODO: fill in needed includes here
void tcc_add_${name}_symbols(TCCState *TCC) {
EOF
for sym in ${(f)syms}; do
# >&2 echo "+ ($name) $sym"
echo "tcc_add_symbol(TCC, \"${sym}\", &${sym});" >> src/${name}.c
done
echo "}" >> src/${name}.c

>&2 echo "Generated symbol declaration: src/${name}.c"
1 change: 0 additions & 1 deletion build/init-embeddings.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ cat <<EOF > ${code}
// from file.c
extern bool cjit_mkdtemp(CJITState *CJIT);
extern int muntar_to_path(const char *path, const uint8_t *buf, const unsigned int len);
extern int muntargz_to_path(const char *path, const uint8_t *buf, const unsigned int len);
// main function
Expand Down
20 changes: 12 additions & 8 deletions build/update-libs.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/bash

set -e

odir=lib/contrib_headers

function fetch() {
Expand Down Expand Up @@ -41,12 +43,14 @@ odir="lib/win32ports/sys"
fetch time.h https://raw.githubusercontent.com/win32ports/sys_time_h/refs/heads/master/sys/time.h
fetch wait.h https://raw.githubusercontent.com/win32ports/sys_wait_h/refs/heads/master/sys/wait.h


[ "$1" = "stb" ] && {
# std headers
if [ -d stb ]; then cd stb && git pull --rebase; cd -
else git clone https://github.com/nothings/stb.git
fi
mkdir -p lib/stb
cp stb/*.h lib/stb/
function clone() {
name=$1
repo=$2
>&2 echo "update $name headers from $repo"
git clone --depth 1 $repo /tmp/$name
mkdir -p lib/$name
}

clone stb https://github.com/nothings/stb.git
cp /tmp/stb/*.h lib/stb
rm -rf /tmp/stb
2 changes: 1 addition & 1 deletion src/muntar.c
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ int muntar_to_path(const char *path, const uint8_t *buf,
#if !defined(NOGUNZIP)
// gunzip and untar all in one
#include <tinf.h>
#define DECOMPRESSED_SIZE_RATIO 8 // raise this on errors
#define DECOMPRESSED_SIZE_RATIO 10 // raise this on errors
int muntargz_to_path(const char *path, const uint8_t *buf,
const unsigned int len) {
if(!buf) {
Expand Down

0 comments on commit ab974b6

Please sign in to comment.