2. builds with meson

This commit is contained in:
BernardoDeLaPlaz 2018-08-15 16:04:59 -04:00 committed by Joe Bryan
parent d9dccd88b6
commit 7a496ea629
18 changed files with 385 additions and 5 deletions

2
.gitignore vendored
View File

@ -30,3 +30,5 @@ node_modules/
# ??
/inst
cscope.*
TAGS
build/

18
.gitmodules vendored Normal file
View File

@ -0,0 +1,18 @@
[submodule "subprojects/softfloat3"]
path = subprojects/softfloat3
url = https://github.com/urbit/berkeley-softfloat-3.git
[submodule "subprojects/commonmark-legacy"]
path = subprojects/commonmark-legacy
url = https://github.com/urbit/commonmark-legacy.git
[submodule "subprojects/ed25519"]
path = subprojects/ed25519
url = https://github.com/urbit/ed25519.git
[submodule "subprojects/murmur3"]
path = subprojects/murmur3
url = https://github.com/urbit/murmur3.git
[submodule "subprojects/libuv"]
path = subprojects/libuv
url = https://github.com/urbit/libuv.git
[submodule "subprojects/http-parser"]
path = subprojects/http-parser
url = https://github.com/urbit/http-parser-legacy

View File

@ -2,7 +2,7 @@
**
** This file is in the public domain.
*/
# include "version.h"
# include "config.h"
/** c3: C environment.
**/
# include "c/portable.h" // C and OS portability

13
include/config.h.in Normal file
View File

@ -0,0 +1,13 @@
#ifndef CONFIG_H
#define CONFIG_H
#mesondefine URBIT_VERSION
#mesondefine U3_OS_linux
#mesondefine U3_OS_bsd
#mesondefine U3_OS_osx
#mesondefine U3_OS_ENDIAN_little
#mesondefine U3_OS_ENDIAN_big
#endif /*CONFIG_H*/

View File

@ -1 +0,0 @@
#define URBIT_VERSION "0.5-devel"

View File

@ -2,7 +2,7 @@
**
*/
#include "all.h"
#include <MurmurHash3.h>
#include <murmur3.h>
/* functions
*/

331
meson.build Normal file
View File

@ -0,0 +1,331 @@
project('urbit', 'c', meson_version: '>=0.29.0')
legacy_meson = false
detect_meson_version = run_command('meson', '--version')
meson_ver = detect_meson_version.stdout()
if(meson_ver == '0.29.0\n')
legacy_meson = true
elif(not meson.version().version_compare('>=0.40.0'))
error('Meson 0.29.0 is last legacy version supported. Otherwise please upgrade to 0.40.0 or higher.')
endif
jets_a_src = [
'jets/a/add.c',
'jets/a/dec.c',
'jets/a/div.c',
'jets/a/gte.c',
'jets/a/gth.c',
'jets/a/lte.c',
'jets/a/lth.c',
'jets/a/mod.c',
'jets/a/mul.c',
'jets/a/sub.c',]
jets_b_src = [
'jets/b/bind.c',
'jets/b/clap.c',
'jets/b/drop.c',
'jets/b/flop.c',
'jets/b/lent.c',
'jets/b/levy.c',
'jets/b/lien.c',
'jets/b/murn.c',
'jets/b/need.c',
'jets/b/reap.c',
'jets/b/reel.c',
'jets/b/roll.c',
'jets/b/skid.c',
'jets/b/skim.c',
'jets/b/skip.c',
'jets/b/scag.c',
'jets/b/slag.c',
'jets/b/snag.c',
'jets/b/sort.c',
'jets/b/turn.c',
'jets/b/weld.c' ]
jets_c_src = [
'jets/c/bex.c',
'jets/c/xeb.c',
'jets/c/can.c',
'jets/c/cap.c',
'jets/c/cat.c',
'jets/c/con.c',
'jets/c/cut.c',
'jets/c/dor.c',
'jets/c/dvr.c',
'jets/c/dis.c',
'jets/c/end.c',
'jets/c/gor.c',
'jets/c/hor.c',
'jets/c/lsh.c',
'jets/c/mas.c',
'jets/c/met.c',
'jets/c/mix.c',
'jets/c/mug.c',
'jets/c/muk.c',
'jets/c/peg.c',
'jets/c/po.c',
'jets/c/pow.c',
'jets/c/rap.c',
'jets/c/rep.c',
'jets/c/rip.c',
'jets/c/rsh.c',
'jets/c/sqt.c',
'jets/c/vor.c',
]
jets_d_src = [
'jets/d/in_has.c',
'jets/d/in_int.c',
'jets/d/in_gas.c',
'jets/d/in_mer.c',
'jets/d/in_put.c',
'jets/d/in_tap.c',
'jets/d/in_uni.c',
'jets/d/in_wyt.c',
'jets/d/in_bif.c',
'jets/d/in_dif.c',
'jets/d/by_gas.c',
'jets/d/by_get.c',
'jets/d/by_has.c',
'jets/d/by_int.c',
'jets/d/by_put.c',
'jets/d/by_uni.c',
'jets/d/by_bif.c',
'jets/d/by_dif.c'
]
jets_e_src = [
'jets/e/aes_ecb.c',
'jets/e/aes_cbc.c',
'jets/e/aesc.c',
'jets/e/cue.c',
'jets/e/fl.c',
'jets/e/jam.c',
'jets/e/mat.c',
'jets/e/mink.c',
'jets/e/mule.c',
'jets/e/parse.c',
'jets/e/rd.c',
'jets/e/rq.c',
'jets/e/rs.c',
'jets/e/rh.c',
'jets/e/rub.c',
#'jets/e/scr.c',
'jets/e/shax.c',
'jets/e/lore.c',
'jets/e/loss.c',
'jets/e/lune.c',
'jets/e/trip.c'
]
jets_e_ed_src = [
'jets/e/ed_puck.c',
'jets/e/ed_sign.c',
'jets/e/ed_veri.c',
'jets/e/ed_shar.c'
]
jets_f_src = [
'jets/f/ap.c',
'jets/f/al.c',
'jets/f/cell.c',
'jets/f/comb.c',
'jets/f/cons.c',
'jets/f/core.c',
'jets/f/face.c',
'jets/f/fitz.c',
'jets/f/flan.c',
'jets/f/flip.c',
'jets/f/flor.c',
'jets/f/fork.c',
'jets/f/help.c',
'jets/f/hike.c',
'jets/f/look.c',
'jets/f/loot.c'
]
jets_f_ut_src = [
'jets/f/ut.c',
'jets/f/ut_burn.c',
'jets/f/ut_buss.c',
'jets/f/ut_conk.c',
'jets/f/ut_crop.c',
'jets/f/ut_find.c',
'jets/f/ut_fire.c',
'jets/f/ut_fish.c',
'jets/f/ut_fuse.c',
'jets/f/ut_gain.c',
'jets/f/ut_lose.c',
'jets/f/ut_mint.c',
'jets/f/ut_mull.c',
'jets/f/ut_nest.c',
'jets/f/ut_peek.c',
'jets/f/ut_peel.c',
'jets/f/ut_play.c',
'jets/f/ut_repo.c',
'jets/f/ut_rest.c',
'jets/f/ut_tack.c',
'jets/f/ut_toss.c',
'jets/f/ut_wrap.c'
]
jets_g_src = [
'jets/g/down.c'
]
jets_src = [
'jets/tree.c'
]
noun_src = ['noun/allocate.c',
'noun/events.c',
'noun/hashtable.c',
'noun/imprison.c',
'noun/jets.c',
'noun/manage.c',
'noun/nock.c',
'noun/retrieve.c',
'noun/trace.c',
'noun/vortex.c',
'noun/xtract.c',
'noun/zave.c']
vere_src = ['vere/ames.c',
#'vere/batz.c',
'vere/behn.c',
'vere/cttp.c',
'vere/foil.c',
#'vere/fuse.c',
'vere/http.c',
'vere/ivory.c',
'vere/king.c',
'vere/main.c',
'vere/newt.c',
'vere/pier.c',
'vere/reck.c',
'vere/save.c',
'vere/serf.c',
'vere/term.c',
'vere/time.c',
'vere/unix.c',
'vere/walk.c']
src_list = [
vere_src, noun_src,
jets_a_src, jets_b_src,
jets_c_src, jets_d_src,
jets_e_src, jets_e_ed_src,
jets_f_src, jets_f_ut_src,
jets_g_src, jets_src]
sources = []
foreach s : src_list
sources += s
endforeach
incdir = include_directories('include/')
conf_data = configuration_data()
conf_data.set('URBIT_VERSION', '"0.5-devel"')
osdet = build_machine.system()
os_c_flags = ['-funsigned-char','-ffast-math']
os_deps = []
os_link_flags = []
if osdet == 'linux'
conf_data.set('U3_OS_linux', true)
if(legacy_meson)
pthread_dep = find_library('pthread')
else
pthread_dep = meson.get_compiler('c').find_library('pthread')
endif
ncurses_dep = dependency('ncurses')
os_deps = os_deps + [pthread_dep, ncurses_dep]
elif osdet == 'darwin'
conf_data.set('U3_OS_osx', true)
# os_c_flags = os_c_flags + ['-bind_at_load']
# os_link_flags = ['-framework CoreServices', '-framework CoreFoundation']
if(legacy_meson)
ncurses_dep = find_library('ncurses')
else
ncurses_dep = meson.get_compiler('c').find_library('ncurses')
endif
os_deps = os_deps + [ncurses_dep]
elif osdet == 'bsd' or osdet == 'freebsd'
conf_data.set('U3_OS_bsd', true)
pthread_dep = meson.get_compiler('c').find_library('pthread')
kvm_dep = meson.get_compiler('c').find_library('kvm')
ncurses_dep = dependency('ncurses')
os_deps = os_deps + [kvm_dep, pthread_dep, ncurses_dep]
else
error('Unsupported OS detected:' + osdet)
endif
endian = build_machine.endian()
if endian == 'little'
conf_data.set('U3_OS_ENDIAN_little', true)
else
error('Little endian encoding required')
endif
configure_file(input : 'include/config.h.in',
output : 'config.h',
configuration : conf_data)
# We expect these libs to supplied with the distribution
curl_dep = dependency('libcurl', version: '>=7.19.0')
if osdet == 'darwin'
libcrypto = meson.get_compiler('c').find_library('crypto', dirs: [ '/usr/local/opt/openssl/lib/' ])
libssl = meson.get_compiler('c').find_library('ssl', dirs: [ '/usr/local/opt/openssl/lib/' ])
openssl_dep = declare_dependency(dependencies: [libcrypto, libssl], include_directories: include_directories('/usr/local/opt/openssl/include'))
else
openssl_dep = dependency('openssl', version: '>=1.0.0')
endif
if(legacy_meson)
gmp_dep = find_library('gmp')
sigsegv_dep = find_library('sigsegv')
else
gmp_dep = meson.get_compiler('c').find_library('gmp')
sigsegv_dep = meson.get_compiler('c').find_library('sigsegv')
endif
# For these libs we provide fallback bundle
cmark_dep = dependency('libcmark', version: '0.12.0', fallback: ['commonmark-legacy', 'cmark_dep'])
ed25519_dep = dependency('ed25519', version: '>=0.1.0', fallback: ['ed25519', 'ed25519_dep'])
murmur3_dep = dependency('murmur3', version: '>=0.1.0', fallback: ['murmur3', 'murmur3_dep'])
softfloat3_dep = dependency('softfloat3', version: '>=3.0.0', fallback: ['softfloat3', 'softfloat3_dep'])
libuv_dep = dependency('libuv', version: '>=1.8.0', fallback:['libuv', 'libuv_dep'])
http_parser_dep = dependency('http-parser', version: '0.1.0', fallback: ['http-parser', 'http_parser_dep'])
executable('urbit',
sources : sources,
include_directories : incdir,
c_args : os_c_flags,
link_args: os_link_flags,
dependencies: [openssl_dep,
curl_dep,
libuv_dep,
http_parser_dep,
cmark_dep,
gmp_dep,
sigsegv_dep,
ed25519_dep,
murmur3_dep,
softfloat3_dep] + os_deps,
install: true)

4
scripts/bootstrap Executable file
View File

@ -0,0 +1,4 @@
#!/bin/bash
git submodule init
git submodule update

5
scripts/build Executable file
View File

@ -0,0 +1,5 @@
#!/bin/bash
mkdir ./build &> /dev/null
meson . ./build --buildtype=release
ninja -C build

2
subprojects/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
# help me create an empty dir
fred

@ -0,0 +1 @@
Subproject commit 8555ef14c4a503f57a0d192bb120159239f4322c

1
subprojects/ed25519 Submodule

@ -0,0 +1 @@
Subproject commit ba4777acac5694925ab78f38577b059cd4a3e8e6

@ -0,0 +1 @@
Subproject commit 90d2cd1a9049a93c291b604fc3c9c4c84cf9bfe2

1
subprojects/libuv Submodule

@ -0,0 +1 @@
Subproject commit 9e3aece8147d28246c57b84731dad26130c7d1c1

1
subprojects/murmur3 Submodule

@ -0,0 +1 @@
Subproject commit 001378cbe3681af1137553ed7220c79273850d6a

@ -0,0 +1 @@
Subproject commit 9d4342099a54cefc3a4117ce0d0c71cff4e48783

View File

@ -22,7 +22,7 @@
#include <openssl/err.h>
#include <openssl/rand.h>
#include "../outside/jhttp/http_parser.h" // Joyent HTTP
#include <http_parser.h> // Joyent HTTP
#include "all.h"
#include "vere/vere.h"

View File

@ -19,7 +19,7 @@
#include <termios.h>
#include <term.h>
#include "../outside/jhttp/http_parser.h" // Joyent HTTP
#include <http_parser.h> // Joyent HTTP
#include "all.h"
#include "vere/vere.h"