build.lua 1743 bytes · raw
-- Bison built by its configure and make (the documentation is in the archive, nothing needs help2man), not installed:
-- the program is copied into libexec/bison/ with the m4 it runs, the skeletons of data/ into share/bison/, and bin/bison
-- is a script giving it both ($M4 and $BISON_PKGDATADIR), wherever the prefix is.
function build(slice, options, deps)
local p = slice.prefix
local m4 = deps.tools.m4.bin .. "/m4"
local env = { CC = slice.toolchain.cc, CFLAGS = table.concat(slice.toolchain.cflags, " "), M4 = m4 }
-- without NLS and yacc: the program alone, which needs no library of the machine
local args = { "sh", slice.source .. "/configure", "--prefix=" .. p, "--disable-nls", "--disable-yacc",
"--disable-dependency-tracking" }
otok.run(args, { cwd = slice.build, env = env })
otok.run({ slice.toolchains.make, "-j" .. slice.jobs }, { cwd = slice.build })
local libexec = p .. "/libexec/bison"
otok.copy(slice.build .. "/src/bison", libexec .. "/bison")
otok.copy(m4, libexec .. "/m4")
local data = p .. "/share/bison"
otok.copy(slice.source .. "/data", data)
otok.remove(data .. "/local.mk")
local program = p .. "/bin/bison"
otok.write(program, [[
#!/bin/sh
# Bison with the m4 beside it and its skeletons (the otok recipe apotocki/bison): it runs $M4 and reads $BISON_PKGDATADIR
# its directory without dirname or any program of PATH
case $0 in */*) bin=${0%/*} ;; *) bin=. ;; esac
here=$(CDPATH= cd -- "$bin/.." && pwd) || exit 1
M4="$here/libexec/bison/m4"
BISON_PKGDATADIR="$here/share/bison"
export M4 BISON_PKGDATADIR
exec "$here/libexec/bison/bison" "$@"
]])
otok.run({ "chmod", "755", program })
return { programs = { bison = program } }
end
recipe.toml 1492 bytes · raw
# The otok recipe of GNU Bison (https://github.com/apotocki/otok): the bison program for the builds of other recipes and
# for projects that deliver it ([tool-deps.bison] with `deliver`), on macOS: built from the release archive with its
# configure and make. Bison runs m4, which it carries in libexec/bison/ beside the program, and reads its skeletons from
# share/bison/: bin/bison is a script running it with both, so it needs nothing of the machine's.
[recipe]
api = 1
library = "bison"
name = "bison"
version = "3.8.2"
revision = 1
# the m4 beside the program is GPL-3.0-or-later as well
license = "GPL-3.0-or-later"
license-files = ["COPYING"]
homepage = "https://www.gnu.org/software/bison/"
documentation = "https://www.gnu.org/software/bison/manual/"
description = "GNU Bison, the parser generator, built from source."
keywords = ["parser", "generator", "yacc", "tool"]
[tool]
programs = ["bison"]
[source]
url = "https://ftp.gnu.org/gnu/bison/bison-3.8.2.tar.xz"
sha256 = "9bba0214ccf7f1079c5d59210045227bcf619519840ebfa80cd3849cff5a5bf2"
mirrors = ["https://ftpmirror.gnu.org/gnu/bison/bison-3.8.2.tar.xz"]
[platforms]
supported = ["macosx"]
build-on = ["macos/xcode"]
[toolchains]
make = { version = ">= 3.81", default-recipe = "apotocki/make" }
# m4, which configure checks and the program runs: a tool dependency rather than a toolchain, so that build.lua may copy
# it beside the program (deps.tools.m4)
[tool-deps.m4]
version = ">= 1.4.6"
default-recipe = "apotocki/m4"