Skip to content

Commit

Permalink
update js-object-tools affects cascade (#5)
Browse files Browse the repository at this point in the history
* wip

* version

* initerpolate

* cascade or parse not merging correctly, example: {key: 0}

* environment parsing
  • Loading branch information
Leif Shackelford committed Mar 2, 2017
1 parent 350bbad commit 291f545
Show file tree
Hide file tree
Showing 33 changed files with 387 additions and 270 deletions.
26 changes: 13 additions & 13 deletions bin/environment.yaml
@@ -1,29 +1,29 @@
XC_RUN: 'xcrun --sdk {XC_PLATFORM}'
XC_RUN: 'xcrun --sdk ${XC_PLATFORM}'
host-mac:
DEVELOPER: $(xcode-select -print-path)
HOST_PLATFORM: mac
host-mac ios:
CROSS_SDK: '{XC_DIR}{SDK_VERSION}.sdk'
CROSS_TOP: '{DEVELOPER}/Platforms/{XC_DIR}.profile/Developer'
FRAMEWORKS: '{CROSS_TOP}/SDKs/{CROSS_SDK}/System/Library/Frameworks/'
INCLUDES: '{CROSS_TOP}/SDKs/{CROSS_SDK}/usr/include'
CROSS_SDK: '${XC_DIR}${SDK_VERSION}.sdk'
CROSS_TOP: '${DEVELOPER}/Platforms/${XC_DIR}.profile/Developer'
FRAMEWORKS: '${CROSS_TOP}/SDKs/${CROSS_SDK}/System/Library/Frameworks/'
INCLUDES: '${CROSS_TOP}/SDKs/${CROSS_SDK}/usr/include'
IPHONEOS_DEPLOYMENT_VERSION: '6.0'
IPHONEOS_PLATFORM: '$({XC_RUN} --show-sdk-profile-path)'
IPHONEOS_SDK: '$({XC_RUN} --show-sdk-path)'
IPHONEOS_SDK_VERSION: '$({XC_RUN} --show-sdk-version)'
SDK_VERSION: '$({XC_RUN} --show-sdk-version)'
IPHONEOS_PLATFORM: '$(${XC_RUN} --show-sdk-profile-path)'
IPHONEOS_SDK: '$(${XC_RUN} --show-sdk-path)'
IPHONEOS_SDK_VERSION: '$(${XC_RUN} --show-sdk-version)'
SDK_VERSION: '$(${XC_RUN} --show-sdk-version)'
XC_DIR: iPhoneOS
XC_PLATFORM: iphoneos
simulator:
XC_DIR: iPhoneSimulator
XC_PLATFORM: iphonesimulator
host-mac mac:
OSX_DEPLOYMENT_VERSION: '10.8'
OSX_PLATFORM: '$({XC_RUN} --show-sdk-profile-path)'
OSX_SDK: '$({XC_RUN} --show-sdk-path)'
OSX_SDK_VERSION: '$({XC_RUN} --show-sdk-version)'
OSX_PLATFORM: '$(${XC_RUN} --show-sdk-profile-path)'
OSX_SDK: '$(${XC_RUN} --show-sdk-path)'
OSX_SDK_VERSION: '$(${XC_RUN} --show-sdk-version)'
PLATFORM: darwin64-x86_64-cc
SDK_VERSION: '$({XC_RUN} --show-sdk-version)'
SDK_VERSION: '$(${XC_RUN} --show-sdk-version)'
XC_PLATFORM: macosx
test-platform:
TEST_SDK_VERSION: 'test-platform-1.0'
12 changes: 12 additions & 0 deletions examples/v8/tmake.yaml
@@ -0,0 +1,12 @@
name: v8
git:
organization: v8/v8
repository: v8/v8
tag: 5.8.283
build:
sources:
x64:
- "*.cc"
- "x64/*.cc"
path:
source: src
17 changes: 10 additions & 7 deletions package.json
@@ -1,7 +1,7 @@
{
"name": "tmake",
"description": "trieMake can fetch, build, and manage c++ dependencies",
"version": "0.5.9",
"version": "0.6.0",
"homepage": "https://github.com/structuresound/tmake",
"author": {
"name": "Leif Shackelford",
Expand All @@ -14,10 +14,12 @@
"bugs": {
"url": "https://github.com/structuresound/tmake/issues"
},
"licenses": [{
"type": "MIT",
"url": "https://github.com/structuresound/tmake/blob/master/LICENSE-MIT"
}],
"licenses": [
{
"type": "MIT",
"url": "https://github.com/structuresound/tmake/blob/master/LICENSE-MIT"
}
],
"engines": {
"node": ">= 6.0.0",
"npm": ">= 3"
Expand Down Expand Up @@ -92,7 +94,7 @@
"file-type": "^3.9.0",
"glob-all": "^3.0.1",
"gunzip-maybe": "^1.3.1",
"js-object-tools": "^0.13.2",
"js-object-tools": "^0.14.7",
"js-yaml": "^3.6.1",
"json-stable-stringify": "^1.0.1",
"lodash": "^4.3.0",
Expand All @@ -111,6 +113,7 @@
"shelljs": "^0.7.6",
"source-map-support": "^0.4.0",
"tar-fs": "^1.13.0",
"unbzip2-stream": "^1.0.10",
"unzip": "^0.1.11",
"vinyl-fs": "^2.3.1",
"which": "^1.2.11"
Expand Down Expand Up @@ -152,4 +155,4 @@
"ignoreFlags": true
}
}
}
}
23 changes: 11 additions & 12 deletions server/libbson/tmake.yaml
Expand Up @@ -9,20 +9,14 @@ configure:
for: ninja
replace:
config:
sources:
- src/bson/bson-config.h.in
- src/bson/bson-version.h.in
matching:
- src/bson/*.h.in
inputs:
BSON_MAJOR_VERSION: 1
BSON_MINOR_VERSION: 3
BSON_MICRO_VERSION: 4
BSON_PRERELEASE_VERSION: rc0
BSON_VERSION: 1.0.0
BSON_BYTE_ORDER:
macro: "{target.endianness}"
map:
LE: 1234
BE: 4321
BSON_VERSION: 1.3.4
BSON_HAVE_STDBOOL_H: 1
BSON_OS: 1
BSON_HAVE_ATOMIC_32_ADD_AND_FETCH: 1
Expand All @@ -38,11 +32,16 @@ configure:
BSON_OS: 2
"mac, linux":
BSON_HAVE_TIMESPEC: 1
BSON_BYTE_ORDER:
macro: ${target.endianness}
map:
LE: 1234
BE: 4321
directive:
prepost: "@"
ext: "h"
include_bson:
sources:
matching:
- src/**/*.h
- src/**/*.c
inputs:
Expand All @@ -53,7 +52,7 @@ configure:
- '#include <bcon.h>'
- '#include <libbson-1.0/bcon.h>'
include_bson_compat:
sources:
matching:
- src/yajl/*.h
- src/yajl/*.c
inputs:
Expand All @@ -62,7 +61,7 @@ configure:
- '#include <libbson-1.0/bson-compat.h>'
build:
with: ninja
sources:
matching:
- src/bson/**.c
- src/yajl/**.c
cFlags:
Expand Down
6 changes: 3 additions & 3 deletions server/mongoc/tmake.yaml
Expand Up @@ -5,7 +5,7 @@ configure:
for: ninja
replace:
files:
sources:
matching:
- src/mongoc/mongoc-config.h.in
- src/mongoc/mongoc-version.h.in
inputs:
Expand Down Expand Up @@ -33,7 +33,7 @@ configure:
prepost: "@"
ext: "h"
include_bson:
sources:
matching:
- src/**/*.h
- src/**/*.c
inputs:
Expand All @@ -48,7 +48,7 @@ configure:
- '#include <libbson-1.0/bcon.h>'
build:
with: ninja
sources:
matching:
- src/mongoc/*.c
- "!src/mongoc/mongoc-rand-cng.c"
- "!src/mmongoc/mongoc-stream-tls-secure-channel-private.c"
Expand Down
10 changes: 5 additions & 5 deletions server/mongocxx/tmake.yaml
Expand Up @@ -42,7 +42,7 @@ configure:
#endif
replace:
versions:
sources:
matching:
- src/bsoncxx/config/version.hpp.in
- src/mongocxx/config/version.hpp.in
inputs:
Expand All @@ -57,13 +57,13 @@ configure:
directive:
prepost: "@"
src/mongocxx/config:
sources:
matching:
- src/mongocxx/config/config.hpp.in
- src/mongocxx/config/private/config.hh.in
inputs:
"@MONGOCXX_INLINE_NAMESPACE@": v3_0_3
src/bsoncxx/config:
sources:
matching:
- src/bsoncxx/config/config.hpp.in
- src/bsoncxx/config/private/config.hh.in
inputs:
Expand All @@ -77,7 +77,7 @@ configure:
1"
"@BSONCXX_INLINE_NAMESPACE@": v3_0_3
namespaceIncludes:
sources:
matching:
- src/**/*.h
- src/**/*.hh
- src/**/*.hpp
Expand All @@ -91,7 +91,7 @@ configure:
- '#include <libbson-1.0/bson.h>'
build:
with: ninja
sources:
matching:
- src/bsoncxx/**/*.cpp
- "!src/bsoncxx/test/**"
- src/mongocxx/**/*.cpp
Expand Down
36 changes: 10 additions & 26 deletions server/openssl/tmake.yaml
Expand Up @@ -5,46 +5,30 @@ environment:
OPENSSL_VERSION: 1.0.2h
DEVELOPER: "$(xcode-select -print-path)"
mac:
PLATFORM: darwin64-x86_64-cc
OSX_DEPLOYMENT_VERSION: '10.8'
OSX_SDK_VERSION: "$(xcrun --sdk macosx --show-sdk-version)"
OSX_PLATFORM: "$(xcrun --sdk macosx --show-sdk-platform-path)"
OSX_SDK: "$(xcrun --sdk macosx --show-sdk-path)"
"mac, linux":
ARCH: x86_64
ios:
ARCH: arm64
SDK_VERSION: "$(xcrun --sdk iphoneos --show-sdk-version)"
CROSS_TOP: "{DEVELOPER}/Platforms/iPhoneOS.platform/Developer"
CROSS_SDK: iPhoneOS{SDK_VERSION}.sdk
IPHONEOS_DEPLOYMENT_VERSION: '6.0'
IPHONEOS_SDK_VERSION: "$(xcrun --sdk iphoneos --show-sdk-version)"
IPHONEOS_PLATFORM: "$(xcrun --sdk iphoneos --show-sdk-platform-path)"
IPHONEOS_SDK: "$(xcrun --sdk iphoneos --show-sdk-path)"
TRIPLE: darwin64-x86_64-cc
x64:
OPENSSL_ARCH: x86_64
configure:
"ios, mac, linux":
bignum: sed -ie "s/BIGNUM \*I,/BIGNUM \*i,/g" crypto/rsa/rsa.h
bignum: sed -ie "s/BIGNUM \*I,/BIGNUM \*i,/g" crypto/rsa/rsa.h
mac:
shell:
configure: ./Configure {PLATFORM} --openssldir="{d.build}/openssl-{OPENSSL_VERSION}"
sed: sed -ie "s!^CFLAG=!CFLAG=-isysroot {OSX_SDK} -arch {ARCH} -mmacosx-version-min={OSX_DEPLOYMENT_VERSION}!" "Makefile"
configure: ./Configure ${TRIPLE} --openssldir="${d.build}/openssl-${OPENSSL_VERSION}"
sed: sed -ie "s!^CFLAG=!CFLAG=-isysroot ${OSX_SDK} -arch ${OPENSSL_ARCH} -mmacosx-version-min=${OSX_DEPLOYMENT_VERSION}!" "Makefile"
linux:
configure: ./config enable-tlsext no-shared no-zlib -fPIC no-gost --openssldir="{d.build}/openssl-{OPENSSL_VERSION}"
configure: ./config enable-tlsext no-shared no-zlib -fPIC no-gost --openssldir="${d.build}/openssl-${OPENSSL_VERSION}"
make: make depend
ios:
configure: ./Configure iphoneos-cross -no-asm --openssldir="/tmp/openssl-{OPENSSL_VERSION}-{ARCH}"
configure: ./Configure iphoneos-cross -no-asm --openssldir="/tmp/openssl-${OPENSSL_VERSION}-${OPENSSL_ARCH}"
perl: perl -i -pe 's|static volatile sig_atomic_t intr_signal|static volatile int intr_signal|' crypto/ui/ui_openssl.c
replace:
files:
matching:
- Makefile
inputs:
"-isysroot $(CROSS_TOP)/SDKs/$(CROSS_SDK)": "-isysroot {CROSS_TOP}/SDKs/{CROSS_SDK}
-miphoneos-version-min={SDK_VERSION}"
"-isysroot $(CROSS_TOP)/SDKs/$(CROSS_SDK)": "-isysroot ${CROSS_TOP}/SDKs/${CROSS_SDK} -miphoneos-version-min=${SDK_VERSION}"
build:
with: make
ios:
prefix: CC="{DEVELOPER}/usr/bin/gcc -fembed-bitcode -arch {ARCH}"
prefix: CC="${DEVELOPER}/usr/bin/gcc -fembed-bitcode -arch ${OPENSSL_ARCH}"
path:
project: source
install:
Expand Down
6 changes: 3 additions & 3 deletions server/re2/tmake.yaml
Expand Up @@ -14,16 +14,16 @@ configure:
for: ninja
build:
with: ninja
sources:
matching:
- re2/*.cc
- util/*.cc
linux:
sources:
matching:
- re2/*.cc
- util/*.cc
- "!util/threadwin.cc"
mac:
sources:
matching:
- re2/*.cc
- util/*.cc
- "!util/threadwin.cc"
Expand Down
4 changes: 4 additions & 0 deletions src/@types/unbzip-stream.d.ts
@@ -0,0 +1,4 @@
declare module 'unbzip2-stream' {
function bz2(): NodeJS.ReadWriteStream;
export = bz2;
}
10 changes: 10 additions & 0 deletions src/archive.ts
Expand Up @@ -5,6 +5,7 @@ import * as unzip from 'unzip';
import * as tar from 'tar-fs';
import * as lzma from 'lzma-native';
import gunzip = require('gunzip-maybe');
import bz2 = require('unbzip2-stream');
import * as readChunk from 'read-chunk';
import fileType = require('file-type');
import pstream = require('progress-stream');
Expand Down Expand Up @@ -56,6 +57,15 @@ function unarchive(filePath: string, toDir: string) {
.on('close', finish)
.on('end', finish)
.on('error', reject);
} else if (fileExt === 'bz2') {
return stream
.pipe(bz2())
.pipe(tar.extract(toDir))
.on('progress', (p: string) => console.log(p))
.on('finish', finish)
.on('close', finish)
.on('end', finish)
.on('error', reject);
} else if (fileExt === 'xz') {
return stream
.pipe(unxz)
Expand Down
10 changes: 6 additions & 4 deletions src/build.ts
Expand Up @@ -4,7 +4,7 @@ import * as fs from 'fs';
import { check } from 'js-object-tools';
import { mkdir } from './sh';

import { execAsync } from './sh';
import { execAsync, ensureCommand } from './sh';
import { build as cmake } from './cmake';
import { build as ninja } from './ninja';
import { build as make } from './make';
Expand All @@ -23,10 +23,11 @@ export interface Build {
compilerFlags?: any;
linkerFlags?: any;
defines?: any;
arguments?: any;
prefix?: any;
shell?: any;
frameworks?: any;
sources?: any;
matching?: any;
headers?: any;
libs?: any;
includeDirs?: any;
Expand All @@ -44,7 +45,7 @@ function ensureBuildFolder(env: Environment, isTest?: boolean) {
}
}

function ensureBuildFile(env: Environment, system: string, isTest?: boolean) {
export function ensureBuildFile(env: Environment, system: string, isTest?: boolean) {
const buildFilePath = env.getProjectFilePath(system);
if (!check(buildFilePath, 'String')) {
throw new Error('no build file specified');
Expand All @@ -60,13 +61,14 @@ function buildWith(env: Environment, system: string, isTest: boolean) {
return execAsync(`TMAKE_ARGS="${encodeArgs()}" tmake`, { cwd: env.project.d.source, short: 'tmake' });
}
ensureBuildFolder(env, isTest);
ensureBuildFile(env, system, isTest);
switch (system) {
case 'ninja':
return ninja(env);
case 'cmake':
ensureCommand(system);
return cmake(env);
case 'make':
ensureCommand(system);
return make(env);
default:
throw new Error(`bad build system ${system}`);
Expand Down

0 comments on commit 291f545

Please sign in to comment.