Browse Source

cosmopolitan support

master
alistair 3 years ago
parent
commit
2ce714e6f6
  1. 3
      .gitmodules
  2. 8
      Makefile
  3. 2
      c-colours
  4. 8
      colcat.c
  5. 17
      readme.md

3
.gitmodules vendored

@ -1,3 +0,0 @@ @@ -1,3 +0,0 @@
[submodule "c-colours"]
path = c-colours
url = git@git.topost.net:alistair/c-colours.git

8
Makefile

@ -6,6 +6,9 @@ default: build @@ -6,6 +6,9 @@ default: build
install: build
sudo cp bin/colcat /usr/local/bin/colcat
installcosmo: cosmo
sudo cp bin/colcat.com /usr/local/bin/colcat
build: colcat.c
gcc -c colcat.c -o bin/colcat.o
gcc -c c-colours/colours.c -o bin/colours.o
@ -16,5 +19,10 @@ debug: colcat.c @@ -16,5 +19,10 @@ debug: colcat.c
gcc -g -c c-colours/colours.c -o bin/colours.o
gcc -g -lm bin/colcat.o bin/colours.o -o bin/colcat
cosmo:
gcc -g -O -DCOSMOPOLITAN -static -fno-pie -no-pie -mno-red-zone -nostdlib -nostdinc -o bin/colcat.com.dbg colcat.c c-colours/colours.c -Wl,--gc-sections -Wl,-z,max-page-size=0x1000 -fuse-ld=bfd -Wl,-T,ape.lds -include cosmopolitan.h crt.o ape.o cosmopolitan.a
objcopy -SO binary bin/colcat.com.dbg bin/colcat.com
clean:
rm bin/*

2
c-colours

@ -1 +1 @@ @@ -1 +1 @@
Subproject commit e2078d705069515d84b934c92ff99f55add77036
Subproject commit fbf7c2522688fbf4d7f2fef852f34fbffe602ef6

8
colcat.c

@ -1,6 +1,12 @@ @@ -1,6 +1,12 @@
#include "c-colours/colours.h"
#ifdef COSMOPOLITAN
#include "cosmopolitan.h"
#else
#include <getopt.h>
#include <stdbool.h>
#endif
#include "c-colours/colours.h"
#define READ_BUFFER_SIZE 200

17
readme.md

@ -43,12 +43,29 @@ performant than the ruby/node/python versions, it just might have bugs. :) @@ -43,12 +43,29 @@ performant than the ruby/node/python versions, it just might have bugs. :)
## Installation
### 1: Use The prebuilt Cosmopolitan binary
Available on the releases tab.
### 2: Build using cosmopolitan
git clone https://git.topost.net/alistair/colcat.git
cd colcat
curl https://storage.googleapis.com/justine/cosmopolitan/cosmopolitan.zip --output cosmopolitan.zip
unzip cosmopolitan.zip
make cosmo
make installcosmo
### 3: Built for local platform
git clone https://git.topost.net/alistair/colcat.git
cd colcat
make
make install
Installs `colcat` to `/usr/local/bin/`
## Similar Programs
- [busyloop/lolcat](https://github.com/busyloop/lolcat/) (Ruby) - the original

Loading…
Cancel
Save