Skip to content

Commit

Permalink
os: reorganize userspace applications and packages
Browse files Browse the repository at this point in the history
  • Loading branch information
ffwff committed Sep 10, 2019
1 parent 1be90fa commit 3d83466
Show file tree
Hide file tree
Showing 115 changed files with 2,081 additions and 37 deletions.
1 change: 1 addition & 0 deletions pkgs/adam
1 change: 1 addition & 0 deletions pkgs/core
7 changes: 7 additions & 0 deletions pkgs/generate-packages.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/sh

for dir in ../userspace/applications/* ../userspace/libraries/*; do
if [[ ! -e $dir ]]; then
ln -sf $dir $(basename $dir)
fi
done
1 change: 1 addition & 0 deletions pkgs/gfx
1 change: 1 addition & 0 deletions pkgs/libc
1 change: 0 additions & 1 deletion pkgs/libc/src

This file was deleted.

1 change: 1 addition & 0 deletions pkgs/libcanvas
1 change: 0 additions & 1 deletion pkgs/libcanvas/src
Submodule src deleted from 842bc2
17 changes: 17 additions & 0 deletions pkgs/libstb/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
_download() {
if [[ ! -f "$2" ]]; then
wget -O"$2" "$1"
fi
}

build() {
_download https://raw.githubusercontent.com/nothings/stb/master/stb_image.h "$build_dir/stb_image.h"
_download https://raw.githubusercontent.com/dhepper/font8x8/master/font8x8_basic.h "$build_dir/font8x8_basic.h"
mkdir -p $opt_toolsdir/include/stb
cp $build_dir/stb_image.h $opt_toolsdir/include/stb/stb_image.h
cp $build_dir/font8x8_basic.h $opt_toolsdir/include/font8x8_basic.h
}

install() {
echo -ne
}
1 change: 1 addition & 0 deletions pkgs/libwm
1 change: 1 addition & 0 deletions pkgs/wm
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion pkgs/gfx/build.sh → userspace/applications/gfx/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ build() {
_download https://raw.githubusercontent.com/dhepper/font8x8/master/font8x8_basic.h "$build_dir/font8x8_basic.h"
_download https://upload.wikimedia.org/wikipedia/en/7/7d/Lenna_%28test_image%29.png "$build_dir/test.png"

${opt_arch}-gcc -O2 -o $build_dir/catimg $script_dir/catimg.c -lm
${opt_arch}-gcc -O2 -o $build_dir/catimg $script_dir/catimg.c -I$opt_toolsdir/include -L$opt_toolsdir/lib -lm
${opt_arch}-gcc -O2 -o $build_dir/canvdem $script_dir/canvdem.c -I$opt_toolsdir/include
# ${opt_arch}-gcc -g -o $build_dir/cairodem $script_dir/cairodem.c -I$opt_toolsdir/include -L$opt_toolsdir/lib -lcairo -lpixman-1 -lm
}
Expand Down
File renamed without changes.
File renamed without changes.
7 changes: 1 addition & 6 deletions pkgs/gfx/catimg.c → userspace/applications/gfx/catimg.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,7 @@

#define STB_IMAGE_IMPLEMENTATION
#define STBI_ASSERT(x)
#include "../.build/stb_image.h"

double ldexp(double x, int exp) {
abort();
return 0.0;
}
#include <stb/stb_image.h>

const int channels = 4;

Expand Down
File renamed without changes.
5 changes: 2 additions & 3 deletions pkgs/wm/canvwin.c → userspace/applications/wm/canvwin.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@

#define LIBCANVAS_IMPLEMENTATION
#include <canvas.h>

#include "../.build/font8x8_basic.h"
#include "wmc.h"
#include <font8x8_basic.h>
#include <wm/wmc.h>

#define INIT_WIDTH 256
#define INIT_HEIGHT 256
Expand Down
5 changes: 2 additions & 3 deletions pkgs/wm/cterm.c → userspace/applications/wm/cterm.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@

#define LIBCANVAS_IMPLEMENTATION
#include <canvas.h>

#include "../.build/font8x8_basic.h"
#include "wmc.h"
#include <font8x8_basic.h>
#include <wm/wmc.h>

#define INIT_WIDTH 400
#define INIT_HEIGHT 256
Expand Down
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions pkgs/wm/wm.c → userspace/applications/wm/wm.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
#include <sys/kbd.h>
#include <syscalls.h>

#include "wm.h"
#include <wm/wm.h>

#define STB_IMAGE_IMPLEMENTATION
#define STBI_ASSERT(x)
#include "../.build/stb_image.h"
#include <stb/stb_image.h>

const int channels = 4;
#define CURSOR_FILE "/hd0/share/cursors/cursor.png"
Expand Down
12 changes: 0 additions & 12 deletions userspace/cr

This file was deleted.

3 changes: 0 additions & 3 deletions userspace/libc/src/prelude.cr

This file was deleted.

1 change: 0 additions & 1 deletion userspace/libc/src/syscall_defs.cr

This file was deleted.

File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ ARCH=i386-elf-lilith
AR = $(ARCH)-ar
CC = $(ARCH)-gcc
AS = $(ARCH)-as
CR=$(shell pwd)/../../toolchain/crystal/.build/crystal
# TODO: not hard code CR
CR=$(shell pwd)/../../../toolchain/crystal/.build/crystal

CRFLAGS=--cross-compile --target i686-elf --prelude ./prelude.cr
CCFLAGS = -Isrc/include -nostdlib -Wall
Expand Down
4 changes: 2 additions & 2 deletions pkgs/libc/build.sh → userspace/libraries/libc/build.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
build() {
pushd .
cd $script_dir/src && \
make -j`nproc` RELEASE=1 && \
cd $script_dir && \
make -B -j`nproc` RELEASE=1 && \
make install \
LIBDIR=$opt_toolsdir/lib/gcc/$opt_arch/8.3.0/ \
INCLUDEDIR=$opt_toolsdir/lib/gcc/$opt_arch/8.3.0/include
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ typedef long ssize_t;
typedef unsigned long uintptr_t;
typedef long intptr_t;
typedef long ptrdiff_t;

typedef unsigned char wchar_t;
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 3 additions & 0 deletions userspace/libraries/libc/src/prelude.cr
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# TODO: this shouldn't be hardcoded
require "../../../../toolchain/crystal/src/primitives.cr"
require "./core.cr"
1 change: 1 addition & 0 deletions userspace/libraries/libc/src/syscall_defs.cr
File renamed without changes.
6 changes: 6 additions & 0 deletions userspace/libraries/libcanvas/src/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
PREFIX ?= /usr
INCLUDEDIR ?= $(PREFIX)/include
.PHONY: install

install: canvas.h
cp canvas.h $(INCLUDEDIR)
7 changes: 7 additions & 0 deletions userspace/libraries/libcanvas/src/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# libcanvas

A single-header canvas library in C.

## License

This library is in public domain, do whatever you want with it!

0 comments on commit 3d83466

Please sign in to comment.