Skip to content

Commit

Permalink
fix build from scratch
Browse files Browse the repository at this point in the history
  • Loading branch information
billywhizz committed Dec 18, 2020
1 parent 1112b08 commit 0afae92
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ function make (opts, ...args) {
const { silent } = opts
if (silent) {
// todo - why are we overriding C and CC here?
const process = launch('make', ['C=gcc', 'CC=g++', ...args], currentDir)
const process = launch('make', [...args], currentDir)
process.onStdout = (buf, len) => {}
process.onStderr = (buf, len) => {}
return watch(process)
}
return watch(launch('make', ['C=gcc', 'CC=g++', ...args], currentDir))
return watch(launch('make', [...args], currentDir))
}

const rx = /[./]/g
Expand Down
16 changes: 15 additions & 1 deletion lib/configure.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const { baseName, fileName, join } = just.path
const acorn = require('acorn')
const { isFile, isDir } = require('fs')
const { mkdir, writeFile } = just.fs
const { launch } = just.process
const appRoot = just.sys.cwd()
const cache = createCache()
Expand Down Expand Up @@ -48,7 +49,7 @@ function getExternalLibrary (originalFileName, fileName) {
if (config.external[originalFileName]) {
just.print(`${originalFileName} found in config`)
} else {
const libsDir = `${JUST_TARGET}/lib`
const libsDir = `${JUST_TARGET}/lib/pg`
if (!isDir(libsDir)) {
just.fs.chdir(JUST_TARGET)
const process = make('libs')
Expand Down Expand Up @@ -208,6 +209,19 @@ function configure (scriptName, opts = {}) {
moduleCache[module.name] = module
}
if (!config.external) config.external = {}
if (!isDir(JUST_TARGET)) {
mkdir(JUST_TARGET)
mkdir(`${JUST_TARGET}/lib`)
}
for (const fileName of builtin.embeds) {
const fn = `${JUST_TARGET}/${fileName}`
if (!isFile(fn)) writeFile(fn, ArrayBuffer.fromString(just.builtin(fileName)))
}
for (const fileName of builtin.libs) {
const fn = `${JUST_TARGET}/${fileName}`
if (!isFile(fn)) writeFile(fn, ArrayBuffer.fromString(just.builtin(fileName)))
}
if (!isFile(`${JUST_TARGET}/Makefile`)) writeFile(`${JUST_TARGET}/Makefile`, ArrayBuffer.fromString(just.builtin('Makefile')))
const { index, libs, modules } = parse(scriptName)
const builtinModules = config.modules.map(v => v.name)
if (!config.target || config.target === 'just') {
Expand Down

0 comments on commit 0afae92

Please sign in to comment.