Skip to content

Commit

Permalink
Kill git submodules with 🔥. Related to #2
Browse files Browse the repository at this point in the history
  • Loading branch information
aw committed Apr 27, 2015
1 parent 7e9d8d6 commit 4148600
Show file tree
Hide file tree
Showing 13 changed files with 75 additions and 55 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
lib/*.so
.lib/
.modules/
7 changes: 0 additions & 7 deletions .gitmodules

This file was deleted.

File renamed without changes.
5 changes: 3 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ sudo: false
cache: apt

before_script:
- ./build.sh
- make
- wget http://software-lab.de/picoLisp-3.1.9.tgz -O /tmp/picolisp.tgz
- cd /tmp; tar -xf /tmp/picolisp.tgz
- cd /tmp/picoLisp/src64 && make
- export PATH=$PATH:/tmp/picoLisp/bin

script:
- cd ${TRAVIS_BUILD_DIR} && /tmp/picoLisp/pil test.l
- cd ${TRAVIS_BUILD_DIR} && make check
57 changes: 57 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# picolisp-json Makefile

MODULE_DIR ?= .modules
SYMLINK_DIR ?= .lib

## Edit below
BUILD_REPO = https://github.com/kgabis/parson.git
BUILD_DIR = $(MODULE_DIR)/parson/HEAD
TARGET = libparson.so
FILES = parson.c
CFLAGS = -O2 -g -Wall -Wextra -std=c89 -pedantic-errors -fPIC -shared
## Edit above

# Unit testing
TEST_REPO = https://github.com/aw/picolisp-unit.git
TEST_DIR = $(MODULE_DIR)/picolisp-unit/HEAD

# Generic
CC = gcc

COMPILE = $(CC) $(CFLAGS)

SHARED = -Wl,-soname,$(TARGET)

.PHONY: all clean

all: $(BUILD_DIR) $(BUILD_DIR)/$(TARGET) symlink

$(BUILD_DIR):
mkdir -p $(BUILD_DIR) && \
git clone $(BUILD_REPO) $(BUILD_DIR)

$(TEST_DIR):
mkdir -p $(TEST_DIR) && \
git clone $(TEST_REPO) $(TEST_DIR)

$(BUILD_DIR)/$(TARGET):
cd $(BUILD_DIR) && \
$(COMPILE) $(SHARED) -o $(TARGET) $(FILES) && \
strip --strip-unneeded $(TARGET)

symlink:
mkdir -p $(SYMLINK_DIR) && \
cd $(SYMLINK_DIR) && \
ln -sf ../$(BUILD_DIR)/$(TARGET) $(TARGET)

check: all $(TEST_DIR) run-tests

run-tests:
./test.l

clean:
cd $(BUILD_DIR) && \
rm -f $(TARGET) && \
cd - && \
cd $(SYMLINK_DIR) && \
rm -f $(TARGET)
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,25 +25,25 @@ Please read [EXPLAIN.md](EXPLAIN.md) to learn more about PicoLisp and this JSON

# Getting Started

These FFI bindings require the [Parson C library](https://github.com/kgabis/parson), compiled as a shared library. It is included here as a [git submodule](http://git-scm.com/book/en/v2/Git-Tools-Submodules).
These FFI bindings require the [Parson C library](https://github.com/kgabis/parson), compiled as a shared library.

1. Type `./build.sh` to pull and compile the _Parson C Library_.
1. Type `make` to pull and compile the _Parson C Library_.
2. Include `json.l` in your project
3. Try the [examples](#examples) below

### Linking and Paths

Once compiled, the shared library is symlinked as:

lib/libparson.so -> vendor/parson/libparson.so
.lib/libparson.so -> .modules/parson/HEAD/libparson.so

The `json.l` file searches for `lib/libparson.so`, relative to its current directory.
The `json.l` file searches for `.lib/libparson.so`, relative to its current directory.

### Updating

This library uses git submodules, type this keep everything updated:
To keep everything updated, type:

./update.sh
make update

# Usage

Expand Down Expand Up @@ -133,9 +133,9 @@ pil +

# Testing

This library now comes with full [unit tests](https://github.com/aw/picolisp-unit). To run the tests, run:
This library now comes with full [unit tests](https://github.com/aw/picolisp-unit). To run the tests, type:

./test.l
make check

# Alternatives

Expand Down
20 changes: 0 additions & 20 deletions build.sh

This file was deleted.

2 changes: 1 addition & 1 deletion json.l
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
(load (pack (car (file)) "module.l"))

(setq
*Native (pack (car (file)) "lib/libparson.so")
*Native (pack (car (file)) ".lib/libparson.so")

*JSONError -1
*JSONNull 1
Expand Down
6 changes: 3 additions & 3 deletions module.l
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
[de MODULE_INFO
("name" "json")
("version" "0.5.2")
("version" "0.6.0")
("summary" "JSON encoder/decoder ffi-bindings for PicoLisp")
("source" "https://github.com/aw/picolisp-json.git")
("author" "Alexander Williams")
("license" "MIT")
("copyright" "(c) 2015 Alexander Williams, Unscramble <license@unscramble.jp>")
("install" "build.sh")
("update" "update.sh")
("install" "make")
("update" "make update")
("requires"
("picolisp-unit" "v0.6.1" "https://github.com/aw/picolisp-unit.git")
("parson" "master" "https://github.com/kgabis/parson.git") ]
2 changes: 1 addition & 1 deletion test.l
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env pil

(load "vendor/picolisp-unit/unit.l")
(load ".modules/picolisp-unit/HEAD/unit.l")

(chdir "test/"
(mapcar load (filter '((N) (sub? "test_" N)) (dir "."))) )
Expand Down
10 changes: 0 additions & 10 deletions update.sh

This file was deleted.

1 change: 0 additions & 1 deletion vendor/parson
Submodule parson deleted from 81c2fd
1 change: 0 additions & 1 deletion vendor/picolisp-unit
Submodule picolisp-unit deleted from 69fe09

0 comments on commit 4148600

Please sign in to comment.