Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • hammer/hammer
  • mlp/hammer
  • xentrac/hammer
  • pesco/hammer
  • letitiali/hammer
  • nobody/hammer
  • kia/hammer-sandbox
  • vyrus001/hammer
  • denleylam/hammer
9 results
Show changes
Commits on Source (619)
Showing with 519 additions and 119 deletions
# generated files
*.o
*~
*.os
*.so
*.a
*.gem
*.pyc
*.class
*.so
jni/com*.h
src/test_suite
lib/hush
libhammer.pc
build/
examples/dns
examples/base64
examples/base64_sem1
examples/base64_sem2
TAGS
*.swp
*.swo
jni/com*.h
src/test_suite
# coverage and profiling stuff
*.gcov
*.gcda
*.gcno
gmon.out
# editor leftovers
*~
*.sw?
\#*
# misc
lib/hush
TAGS
docs/milestone2.dot.pdf
*.dot.pdf
Session.vim
*.gcov
cscope.out
build/
.sconsign.dblite
*.os
*.pyc
sudo: required
dist: trusty
language: c
compiler:
- gcc
......@@ -6,13 +8,45 @@ env:
- BINDINGS=none
matrix:
include:
- compiler: gcc
language: ruby
rvm: ruby-1.9.3-p551
env: BINDINGS=ruby
- compiler: clang
language: ruby
rvm: ruby-1.9.3-p551
env: BINDINGS=ruby CC=clang
- compiler: gcc
language: ruby
rvm: ruby-2.0.0-p647
env: BINDINGS=ruby
- compiler: clang
language: ruby
rvm: ruby-2.0.0-p647
env: BINDINGS=ruby CC=clang
- compiler: gcc
language: ruby
rvm: ruby-2.1.7
env: BINDINGS=ruby
- compiler: clang
language: ruby
rvm: ruby-2.1.7
env: BINDINGS=ruby CC=clang
- compiler: gcc
language: ruby
rvm: ruby-2.2.3
env: BINDINGS=ruby
- compiler: clang
language: ruby
rvm: ruby-2.2.3
env: BINDINGS=ruby CC=clang
- compiler: gcc
language: python
python: "2.7"
python: "2.7.10"
env: BINDINGS=python
- compiler: clang
language: python
python: "2.7"
python: "2.7.10"
env: BINDINGS=python CC=clang
- compiler: gcc
language: perl
......@@ -54,21 +88,36 @@ matrix:
language: php
php: "5.4"
env: BINDINGS=php CC=clang
- compiler: gcc
language: dotnet
env: BINDINGS=dotnet
- compiler: clang
language: dotnet
env: BINDINGS=dotnet CC=clang
- compiler: gcc
language: cpp
env: BINDINGS=cpp
- compiler: clang
language: cpp
env: BINDINGS=cpp CC=clang
before_install:
- sudo apt-get update -qq
- if [ "$BINDINGS" != "none" ]; then sudo apt-get install -qq swig; fi
- if [ "$BINDINGS" == "perl" ]; then sudo add-apt-repository ppa:dns/irc -y; sudo apt-get update -qq; sudo apt-get install -qq swig=2.0.8-1irc1~12.04; fi
- if [ "$BINDINGS" == "python" ]; then sudo apt-get install -qq python-dev; fi
- sudo apt-get install -y lcov
- gem install coveralls-lcov
- if [ "$BINDINGS" != "none" ]; then sudo sh -c 'echo "deb http://archive.ubuntu.com/ubuntu trusty-backports main restricted universe multiverse" >> /etc/apt/sources.list'; sudo apt-get update -qq; sudo apt-get install -yqq swig3.0/trusty-backports; fi
- if [ "$BINDINGS" == "python" ]; then sudo apt-get install -yqq python-dev; fi
- if [ "$BINDINGS" == "dotnet" ]; then sudo add-apt-repository ppa:directhex/monoxide -y; sudo apt-get update -qq; sudo apt-get install -yqq mono-devel mono-mcs nunit nunit-console; mozroots --import --sync; fi
install: true
before_script:
- if [ "$BINDINGS" == "php" ]; then phpenv config-add src/bindings/php/hammer.ini; fi
script:
- scons bindings=$BINDINGS test
script:
- if [ "$BINDINGS" == "none" ]; then scons test --variant=debug --coverage; else scons bindings=$BINDINGS test; fi
after_success:
- if [ "$BINDINGS" == "none" ]; then if [ "$CC" == "clang" ]; then llvm-cov gcov -o coverage.info build/debug/src/test_suite.gcda; else lcov --capture --directory build/debug/src --output-file coverage.info; fi; fi
- coveralls-lcov coverage.info
notifications:
irc:
channels:
- "irc.upstandinghackers.com#hammer"
use_notice: true
skip_join: true
......@@ -6,12 +6,13 @@ internal anaphoric macros use. Chances are that if you use these names
for other things, you're gonna have a bad time.
In particular, these names, and the macros that use them, are:
- state:
Used by a_new and company. Should be an HParseState*
- mm__:
Used by h_new and h_free. Should be an HAllocator*
- stk__:
Used in desugaring. Should be an HCFStack*
- `state`:
Used by `a_new` and company. Should be an `HParseState*`.
- `mm__`:
Used by `h_new` and `h_free`. Should be an `HAllocator*`.
- `stk__`:
Used in desugaring. Should be an `HCFStack*`.
Function suffixes
=================
......@@ -21,9 +22,9 @@ parameters or parameters in multiple different forms. For example,
often, you have a global memory manager that is used for an entire
program. In this case, you can leave off the memory manager arguments
off, letting them be implicit instead. Further, it is often convenient
to pass an array or va_list to a function instead of listing the
arguments inline (eg, for wrapping a function, generating the
arguments programattically, or writing bindings for another language.
to pass an array or `va_list` to a function instead of listing the
arguments inline (e.g., for wrapping a function, generating the
arguments programatically, or writing bindings for another language.)
Because we have found that most variants fall into a fairly small set
of forms, and to minimize the amount of API calls that users need to
......@@ -32,21 +33,22 @@ variants: the function name is followed by two underscores and a set
of single-character "flags" indicating what optional features that
particular variant has (in alphabetical order, of course):
__a: takes variadic arguments as a void*[] (not implemented yet, but will be soon.
__m: takes a memory manager as the first argument, to override the system memory manager.
__v: Takes the variadic argument list as a va_list
- `__a`: takes variadic arguments as a `void*[]` (not implemented yet,
but will be soon.)
- `__m`: takes a memory manager as the first argument, to override the
system memory manager.
- `__v`: Takes the variadic argument list as a `va_list`.
Memory managers
===============
If the __m function variants are used or system_allocator is
If the `__m` function variants are used or `system_allocator` is
overridden, there come some difficult questions to answer,
particularly regarding the behavior when multiple memory managers are
combined. As a general rule of thumb (exceptions will be explicitly
documented), assume that
If you have a function f, which is passed a memory manager m and
> If you have a function f, which is passed a memory manager m and
returns a value r, any function that uses r as a parameter must
also be told to use m as a memory manager.
......@@ -57,6 +59,10 @@ Language-independent test suite
There is a language-independent representation of the Hammer test
suite in `lib/test-suite`. This is intended to be used with the
tsparser.pl prolog library, along with a language-specific frontend.
tsparser.pl Prolog library, along with a language-specific frontend.
Only the C# frontend exists so far; to regenerate the test suites using it, run
$ swipl -q -t halt -g tsgencsharp:prolog tsgencsharp.pl \
>../src/bindings/dotnet/test/hammer_tests.cs
No language-specific frontends have been written yet.
......@@ -3,7 +3,7 @@
# and kick off a recursive make
# Also, "make src/all" turns into "make -C src all"
SUBDIRS = src examples jni
SUBDIRS = src examples src/bindings/jni
include config.mk
TOPLEVEL=.
......
Hammer is a parsing library. Like many modern parsing libraries, it provides a parser combinator interface for writing grammars as inline domain-specific languages, but Hammer also provides a variety of parsing backends. It's also bit-oriented rather than character-oriented, making it ideal for parsing binary data such as images, network packets, audio, and executables.
Hammer is written in C, but will provide bindings for other languages. If you don't see a language you're interested in on the list, just ask.
Hammer is written in C, but provides bindings for other languages. If you don't see a language you're interested in on the list, just ask.
Hammer currently builds under Linux and OS X. (Windows is coming.)
Hammer currently builds under Linux, OS X, and Windows.
[![Build Status](https://travis-ci.org/UpstandingHackers/hammer.png)](https://travis-ci.org/UpstandingHackers/hammer)
Features
========
* Bit-oriented -- grammars can include single-bit flags or multi-bit constructs that span character boundaries, with no hassle
* Thread-safe, reentrant
* Thread-safe, reentrant (for most purposes; see Known Issues for details)
* Benchmarking for parsing backends -- determine empirically which backend will be most time-efficient for your grammar
* Parsing backends:
* Packrat parsing
......@@ -17,32 +16,43 @@ Features
* LALR
* Regular expressions
* Language bindings:
* C++ (not yet implemented)
* Java (not currently building; give us a few days)
* C++
* Java (incomplete)
* Python
* Ruby (not yet implemented)
* Ruby
* Perl
* [Go](https://github.com/prevoty/hammer)
* PHP (not yet implemented)
* .NET (not yet implemented)
* PHP
* .NET
* Lua (landing soon!)
Installing
==========
### Prerequisites
* SCons
* [SCons](http://scons.org/)
### Optional Dependencies
* pkg-config (for `scons test`)
* glib-2.0 (>= 2.29) (for `scons test`)
* glib-2.0-dev (for `scons test`)
* swig (for Python/Perl bindings; Perl requires >= 2.0.8)
* python2.7-dev (for Python bindings)
* [swig](http://swig.org/) (for Python/Perl/PHP bindings; Perl requires >= 2.0.8; Python 3.x requires >= 3.0.0)
* python2.7-dev (for Python 2 bindings)
* python3-dev (>= 3.5) (for Python 3 bindings)
* a JDK (for Java bindings)
* a working [phpenv](https://github.com/CHH/phpenv) configuration (for PHP bindings)
* [Ruby](https://www.ruby-lang.org/) >= 1.9.3 and bundler, for the Ruby bindings
* mono-devel and mono-mcs (>= 3.0.6) (for .NET bindings)
* [nunit](http://www.nunit.org/) (for testing .NET bindings)
To build, type `scons`. To run the built-in test suite, type `scons test`. For a debug build, add `--variant=debug`
To build, type `scons`.
To run the built-in test suite, type `scons test`.
To avoid the test dependencies, add `--no-tests`.
For a debug build, add `--variant=debug`.
To build bindings, pass a "bindings" argument to scons, e.g. `scons bindings=python`. `scons bindings=python test` will build Python bindings and run tests for both C and Python. `--variant=debug` is valid here too. You can build more than one set of bindings at a time; just separate them with commas, e.g. `scons bindings=python,perl`.
For Python, pass `python=python<X>.<Y>`, e. g. `scons bindings=python python=python2.7` or `scons bindings=python python=python3.5`.
For Java, if jni.h and jni_md.h aren't already somewhere on your include path, prepend
`C_INCLUDE_PATH=/path/to/jdk/include` to that.
......@@ -56,22 +66,31 @@ Just `#include <hammer/hammer.h>` (also `#include <hammer/glue.h>` if you plan t
If you've installed Hammer system-wide, you can use `pkg-config` in the usual way.
To learn about hammer check
* the [user guide](https://github.com/UpstandingHackers/hammer/wiki/User-guide)
* [Hammer Primer](https://github.com/sergeybratus/HammerPrimer) (outdated in terms of code, but good to get the general thinking)
* [Try Hammer](https://github.com/sboesen/TryHammer)
Examples
========
The `examples/` directory contains some simple examples, currently including:
* base64
* DNS
* [base64](https://en.wikipedia.org/wiki/Base64)
* [DNS](https://en.wikipedia.org/wiki/Domain_Name_System)
Known Issues
============
The Python bindings only work with Python 2.7. SCons doesn't work with Python 3, and PyCapsule isn't available in 2.6 and below, so 2.7 is all you get. Sorry about that.
The Python bindings work with Python 2.7, and Python 3.5+.
The requirement for SWIG >= 2.0.8 for Perl bindings is due to a [known bug](http://sourceforge.net/p/swig/patches/324/) in SWIG. [ppa:dns/irc](https://launchpad.net/~dns/+archive/irc) has backports of SWIG 2.0.8 for Ubuntu versions 10.04-12.10; you can also [build SWIG from source](http://www.swig.org/download.html).
The .NET bindings are for Mono 3.0.6 and greater. If you're on a Debian-based distro that only provides Mono 2 (e.g., Ubuntu 12.04), there are backports for [3.0.x](http://www.meebey.net/posts/mono_3.0_preview_debian_ubuntu_packages/), and a [3.2.x PPA](https://launchpad.net/~directhex/+archive/monoxide) maintained by the Mono team.
The regular expression backend is potentially not thread-safe (thanks to Martin Murray for pointing this out). A full rewrite of this backend is on the roadmap already due to some unexpected nondeterminism in the current implementation; we plan to fix this problem in that rewrite.
Community
=========
Please join us at `#hammer` on `irc.upstandinghackers.com` if you have any questions or just want to talk about parsing.
Mailing list, IRC, and potentially other channels to come.
Contact
=======
You can also email us at <hammer@upstandinghackers.com>.
Also to be updated soon.
# -*- python -*-
from __future__ import absolute_import, division, print_function
import os
import os.path
import platform
import subprocess
import sys
default_install_dir='/usr/local'
if platform.system() == 'Windows':
default_install_dir = 'build' # no obvious place for installation on Windows
vars = Variables(None, ARGUMENTS)
vars.Add(PathVariable('DESTDIR', "Root directory to install in (useful for packaging scripts)", None, PathVariable.PathIsDirCreate))
vars.Add(PathVariable('prefix', "Where to install in the FHS", "/usr/local", PathVariable.PathAccept))
vars.Add(ListVariable('bindings', 'Language bindings to build', 'none', ['python', 'perl', 'php']))
vars.Add(ListVariable('bindings', 'Language bindings to build', 'none', ['cpp', 'dotnet', 'jni', 'perl', 'php', 'python', 'ruby']))
vars.Add('python', 'Python interpreter', 'python')
env = Environment(ENV = {'PATH' : os.environ['PATH']}, variables = vars, tools=['default', 'scanreplace'], toolpath=['tools'])
tools = ['default', 'scanreplace']
if 'dotnet' in ARGUMENTS.get('bindings', []):
tools.append('csharp/mono')
# add the clang tool if necessary
if os.getenv('CC') == 'clang' or platform.system() == 'Darwin':
tools.append('clang')
else:
# try to detect if cc happens to be clang by inspecting --version
cc = os.getenv('CC') or 'cc'
ver = subprocess.run([cc, '--version'], capture_output=True).stdout
if b'clang' in ver.split():
tools.append('clang')
os.environ['CC'] = cc # make sure we call it as we saw it
envvars = {'PATH' : os.environ['PATH']}
if 'PKG_CONFIG_PATH' in os.environ:
envvars['PKG_CONFIG_PATH'] = os.environ['PKG_CONFIG_PATH']
if platform.system() == 'Windows':
# from the scons FAQ (keywords: LNK1104 TEMPFILE), needed by link.exe
envvars['TMP'] = os.environ['TMP']
env = Environment(ENV = envvars,
variables = vars,
tools=tools,
toolpath=['tools'])
if not 'bindings' in env:
env['bindings'] = []
......@@ -17,7 +51,7 @@ if not 'bindings' in env:
def calcInstallPath(*elements):
path = os.path.abspath(os.path.join(*map(env.subst, elements)))
if 'DESTDIR' in env:
path = os.path.join(env['DESTDIR'], os.path.relpath(path, start="/"))
path = os.path.join(env['DESTDIR'], os.path.relpath(path, start='/'))
return path
rel_prefix = not os.path.isabs(env['prefix'])
......@@ -25,97 +59,165 @@ env['prefix'] = os.path.abspath(env['prefix'])
if 'DESTDIR' in env:
env['DESTDIR'] = os.path.abspath(env['DESTDIR'])
if rel_prefix:
print >>sys.stderr, "--!!-- You used a relative prefix with a DESTDIR. This is probably not what you"
print >>sys.stderr, "--!!-- you want; files will be installed in"
print >>sys.stderr, "--!!-- %s" % (calcInstallPath("$prefix"),)
print('--!!-- You used a relative prefix with a DESTDIR. This is probably not what you', file=sys.stderr)
print('--!!-- you want; files will be installed in', file=sys.stderr)
print('--!!-- %s' % (calcInstallPath('$prefix'),), file=sys.stderr)
env['libpath'] = calcInstallPath("$prefix", "lib")
env['incpath'] = calcInstallPath("$prefix", "include", "hammer")
env['parsersincpath'] = calcInstallPath("$prefix", "include", "hammer", "parsers")
env['backendsincpath'] = calcInstallPath("$prefix", "include", "hammer", "backends")
env['pkgconfigpath'] = calcInstallPath("$prefix", "lib", "pkgconfig")
env['libpath'] = calcInstallPath('$prefix', 'lib')
env['incpath'] = calcInstallPath('$prefix', 'include', 'hammer')
env['parsersincpath'] = calcInstallPath('$prefix', 'include', 'hammer', 'parsers')
env['backendsincpath'] = calcInstallPath('$prefix', 'include', 'hammer', 'backends')
env['pkgconfigpath'] = calcInstallPath('$prefix', 'lib', 'pkgconfig')
env.ScanReplace('libhammer.pc.in')
env.MergeFlags("-std=gnu99 -Wall -Wextra -Werror -Wno-unused-parameter -Wno-attributes")
AddOption('--variant',
dest='variant',
nargs=1, type='choice',
choices=['debug', 'opt'],
default='opt',
action='store',
help='Build variant (debug or opt)')
if env['PLATFORM'] == 'darwin':
env.Append(SHLINKFLAGS = '-install_name ' + env["libpath"] + '/${TARGET.file}')
else:
env.MergeFlags("-lrt")
AddOption("--variant",
dest="variant",
nargs=1, type="choice",
choices=["debug", "opt"],
default="opt",
action="store",
help="Build variant (debug or opt)")
AddOption("--coverage",
dest="coverage",
AddOption('--coverage',
dest='coverage',
default=False,
action="store_true",
help="Build with coverage instrumentation")
action='store_true',
help='Build with coverage instrumentation')
AddOption('--force-debug',
dest='force_debug',
default=False,
action='store_true',
help='Build with debug symbols, even in the opt variant')
AddOption("--in-place",
dest="in_place",
AddOption('--gprof',
dest='gprof',
default=False,
action="store_true",
help="Build in-place, rather than in the build/<variant> tree")
help='Build with profiling instrumentation for gprof')
AddOption('--in-place',
dest='in_place',
default=False,
action='store_true',
help='Build in-place, rather than in the build/<variant> tree')
AddOption('--no-tests',
dest='with_tests',
default=env['PLATFORM'] != 'win32',
action='store_false',
help='Do not build tests')
env['CC'] = os.getenv('CC') or env['CC']
env['CXX'] = os.getenv('CXX') or env['CXX']
env['CFLAGS'] = os.getenv('CFLAGS') or env['CFLAGS']
# Language standard and warnings
if env['CC'] == 'cl':
env.MergeFlags('-W3 -WX')
env.Append(
CPPDEFINES=[
'_CRT_SECURE_NO_WARNINGS' # allow uses of sprintf
],
CFLAGS=[
'-wd4018', # 'expression' : signed/unsigned mismatch
'-wd4244', # 'argument' : conversion from 'type1' to 'type2', possible loss of data
'-wd4267', # 'var' : conversion from 'size_t' to 'type', possible loss of data
]
)
else:
if env['PLATFORM'] == 'darwin':
# It's reported -D_POSIX_C_SOURCE breaks the Mac OS build; I think we
# may need _DARWIN_C_SOURCE instead/in addition to, but let's wait to
# have access to a Mac to test/repo
env.MergeFlags('-std=c99 -Wall -Wextra -Werror -Wno-unused-parameter -Wno-attributes -Wno-unused-variable')
else:
# Using -D_POSIX_C_SOURCE=200809L here, not on an ad-hoc basis when,
# #including, is important
env.MergeFlags('-std=c99 -D_POSIX_C_SOURCE=200809L -Wall -Wextra -Werror -Wno-unused-parameter -Wno-attributes -Wno-unused-variable')
# Linker options
if env['PLATFORM'] == 'darwin':
env.Append(SHLINKFLAGS = '-install_name ' + env['libpath'] + '/${TARGET.file}')
elif platform.system() == 'OpenBSD':
pass
elif env['PLATFORM'] == 'win32':
# no extra lib needed
pass
else:
env.MergeFlags('-lrt')
if GetOption('coverage'):
env.Append(CCFLAGS=['--coverage'],
LDFLAGS=['--coverage'],
LINKFLAGS=['--coverage'])
if env['CC'] == 'gcc':
env.Append(LIBS=['gcov'])
else:
env.ParseConfig('llvm-config --ldflags')
if GetOption('force_debug'):
if env['CC'] == 'cl':
env.Append(CCFLAGS=['/Z7'])
else:
env.Append(CCFLAGS=['-g'])
if GetOption('gprof'):
if env['CC'] == 'gcc' and env['CXX'] == 'g++':
env.Append(CCFLAGS=['-pg'],
LDFLAGS=['-pg'],
LINKFLAGS=['-pg'])
env['GPROF'] = 1
else:
print("Can only use gprof with gcc")
Exit(1)
dbg = env.Clone(VARIANT='debug')
dbg.Append(CCFLAGS=['-g'])
if env['CC'] == 'cl':
dbg.Append(CCFLAGS=['/Z7'])
else:
dbg.Append(CCFLAGS=['-g'])
opt = env.Clone(VARIANT='opt')
opt.Append(CCFLAGS=["-O3"])
if env['CC'] == 'cl':
opt.Append(CCFLAGS=['/O2'])
else:
opt.Append(CCFLAGS=['-O3'])
if GetOption("variant") == 'debug':
if GetOption('variant') == 'debug':
env = dbg
else:
env = opt
if GetOption("coverage"):
env.Append(CFLAGS=["-fprofile-arcs", "-ftest-coverage"],
CXXFLAGS=["-fprofile-arcs", "-ftest-coverage"],
LDFLAGS=["-fprofile-arcs", "-ftest-coverage"],
LIBS=['gcov'])
env["CC"] = os.getenv("CC") or env["CC"]
env["CXX"] = os.getenv("CXX") or env["CXX"]
if os.getenv("CC") == "clang" or env['PLATFORM'] == 'darwin':
env.Replace(CC="clang",
CXX="clang++")
env["ENV"].update(x for x in os.environ.items() if x[0].startswith("CCC_"))
env['ENV'].update(x for x in os.environ.items() if x[0].startswith('CCC_'))
#rootpath = env['ROOTPATH'] = os.path.abspath('.')
#env.Append(CPPPATH=os.path.join('#', "hammer"))
#env.Append(CPPPATH=os.path.join('#', 'hammer'))
testruns = []
targets = ["$libpath",
"$incpath",
"$parsersincpath",
"$backendsincpath",
"$pkgconfigpath"]
targets = ['$libpath',
'$incpath',
'$parsersincpath',
'$backendsincpath',
'$pkgconfigpath']
Export('env')
Export('testruns')
Export('targets')
if not GetOption("in_place"):
if not GetOption('in_place'):
env['BUILD_BASE'] = 'build/$VARIANT'
lib = env.SConscript(["src/SConscript"], variant_dir='$BUILD_BASE/src')
env.Alias("examples", env.SConscript(["examples/SConscript"], variant_dir='$BUILD_BASE/examples'))
lib = env.SConscript(['src/SConscript'], variant_dir='$BUILD_BASE/src')
env.Alias('examples', env.SConscript(['examples/SConscript'], variant_dir='$BUILD_BASE/examples'))
else:
env['BUILD_BASE'] = '.'
lib = env.SConscript(["src/SConscript"])
env.Alias(env.SConscript(["examples/SConscript"]))
lib = env.SConscript(['src/SConscript'])
env.Alias(env.SConscript(['examples/SConscript']))
for testrun in testruns:
env.Alias("test", testrun)
env.Alias('test', testrun)
env.Alias("install", targets)
env.Alias('install', targets)
platform:
- x86
- x64
environment:
PYTHON: "C:\\Python27"
version: 1.0.{build}
os: Visual Studio 2015
install:
- SET "PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%"
- easy_install scons
build_script:
- scons --version
- scons install
- '@echo off'
- setlocal
- ps: >-
If ($env:Platform -Match "x86") {
$env:VCVARS_PLATFORM="x86"
} Else {
$env:VCVARS_PLATFORM="amd64"
}
- call "%VS140COMNTOOLS%\..\..\VC\vcvarsall.bat" %VCVARS_PLATFORM%
- call tools\windows\build.bat
- call tools\windows\build_examples.bat
- exit /b 0
work
# Created by thequux for Upstanding Hackers
# Copyright (c) 2014 Upstanding Hackers
#
# The contents of this file are available under the 2-clause BSD
# license.
PORTNAME = hammer
PORTVERSION = 0.9
CATEGORIES = devel
EXTRACT_SUFX = .tar.bz2
USES = scons
# MASTER_SITE
MAINTAINER = thequux@upstandinghackers.com
COMMENT = Parser combinators. In C.
LICENSE = GPLv2
GIT_REV = master
GIT_URL = git://github.com/UpstandingHackers/hammer.git
SCONS_ARGS = --variant=opt DESTDIR=${STAGEDIR} prefix=${LOCALBASE}
SCONS_TARGET = all
SCONS_INSTALL_TARGET = install
do-fetch:
${MKDIR} ${WRKDIR}
git clone -b ${GIT_REV} ${GIT_URL} ${WRKDIR}/${DISTNAME}
cd ${WRKDIR}; tar cvfy ${DISTDIR}/${DISTNAME}.tar.bz2 ${DISTNAME}
rm -rf ${WRKDIR}/${DISTNAME}
FETCH_DEPENDS += git:${PORTSDIR}/devel/git
# TODO: strip libhammer.so
.include <bsd.port.mk>
Hammer is a fast parser combinator library written in C with bindings
for many languages.
WWW: http://github.com/UpstandingHackers/hammer
\ No newline at end of file
include/hammer/internal.h
include/hammer/allocator.h
include/hammer/parsers/parser_internal.h
include/hammer/backends/regex.h
include/hammer/backends/contextfree.h
include/hammer/glue.h
include/hammer/hammer.h
lib/libhammer.so
lib/libhammer.a
lib/pkgconfig/libhammer.pc
@dirrm include/hammer/parsers
@dirrm include/hammer/backends
@dirrm include/hammer
@dirrmtry lib/pkgconfig
\ No newline at end of file
Parser combinators! In C!
# $NetBSD$
VERSION= 1.0.0-rc3
DISTNAME= hammer-${VERSION}
DISTFILES= v${VERSION}${EXTRACT_SUFX}
CATEGORIES= devel
LICENSE= gnu-gpl-v2
MASTER_SITES= https://github.com/UpstandingHackers/hammer/archive/
MAINTAINER= thequux@upstandinghackers.com
HOMEPAGE= http://github.com/UpstandingHackers/hammer
COMMENT= Parser combinator library in C
USE_TOOLS+= gtar
USE_LANGUAGES= c c++
#TOOLS_GTAR= ${TOOL_GTAR}
FETCH_USING:= fetch
EXTRACT_USING= gtar
BUILD_DEPENDS+= scons-[0-9]*:../../devel/scons
FIND_PREFIX:= SCONSDIR=scons
.include "../../mk/find-prefix.mk"
SCONS_ARGS= --variant=opt DESTDIR=${DESTDIR} prefix=${PREFIX}
do-build:
cd ${WRKSRC} && ${SCONSDIR}/bin/scons ${SCONS_ARGS}
do-install:
cd ${WRKSRC} && ${SCONSDIR}/bin/scons ${SCONS_ARGS} install
.include "../../mk/bsd.pkg.mk"
@comment $NetBSD$
include/hammer/internal.h
include/hammer/allocator.h
include/hammer/parsers/parser_internal.h
include/hammer/backends/regex.h
include/hammer/backends/contextfree.h
include/hammer/glue.h
include/hammer/hammer.h
lib/libhammer.so
lib/libhammer.a
lib/pkgconfig/libhammer.pc
$NetBSD$
SHA1 (v1.0.0-rc3.tar.gz) = 3e578d7f0e0a201aea7707c6041e48ec10ed7609
RMD160 (v1.0.0-rc3.tar.gz) = c5863519d945dd63444bc478d0dac9abdc2a9a4b
Size (v1.0.0-rc3.tar.gz) = 1335437 bytes
# $OpenBSD: Makefile.template,v 1.67 2013/07/10 15:22:23 bcallah Exp $
COMMENT = parser combinators in C
HAMMER_VERSION=1.0.0-rc3
DISTNAME = v${HAMMER_VERSION}
PKGNAME = hammer-${HAMMER_VERSION}
# for any port that creates shared libraries.
# both libtool and cmake handle this automatically.
# for libtool-based ports, have a look at WRKBUILD/shared_libs.log
#SHARED_LIBS = ???
CATEGORIES = devel
MODULES= devel/scons
HOMEPAGE = https://github.com/UpstandingHackers/hammer
MAINTAINER = TQ Hirsch <thequux@upstandinghackers.com>
# License GPLv2
PERMIT_PACKAGE_CDROM = Yes
PERMIT_PACKAGE_FTP = Yes
PERMIT_DISTFILES_FTP = Yes
# "make port-lib-depends-check" can help
#WANTLIB = ???
# where the source files and patches can be fetched
#
MASTER_SITES = https://github.com/UpstandingHackers/hammer/archive/
DIST_SUBDIR = hammer-${HAMMER_VERSION}
WRKDIST= ${WRKDIR}/${PKGNAME}
#MODULES = ???
TEST_DEPENDS = devel/glib2
#BUILD_DEPENDS = scons
#RUN_DEPENDS = ???
#LIB_DEPENDS = ???
#TEST_DEPENDS = ???
#MAKE_FLAGS = ???
#DESTDIRNAME = DESTIR_IGNOREME
#FAKE_FLAGS = ???
#TEST_FLAGS = ???
# build/configuration variables
#
#MODSCONS_ENV+= DESTDIR=${DESTDIR} prefix=${PREFIX}
MODSCONS_ENV+= prefix=${TRUEPREFIX}
MODSCONS_OPTS+= --variant=opt
#ALL_TARGET = ???
#INSTALL_TARGET = ???
#TEST_TARGET = ???
MODSCONS_TEST_TARGET = \
${SETENV} ${MAKE_ENV} ${MODSCONS_BIN} -C ${WRKSRC} \
${MODSCONS_ENV} ${MODSCONS_FLAGS} ${TEST_TARGET}
do-test:
@$(MODSCONS_TEST_TARGET)
.include <bsd.port.mk>
SHA256 (hammer-1.0.0-rc3/v1.0.0-rc3.tar.gz) = AUAEvOeyX0LXqduL+0SxsfxYcsKGKRp3XbtdwLOkHTk=
SIZE (hammer-1.0.0-rc3/v1.0.0-rc3.tar.gz) = 1335437
Parser combinators in C.
@comment $OpenBSD$
lib/libhammer.so
@comment $OpenBSD$
%%SHARED%%
include/hammer/
include/hammer/allocator.h
include/hammer/backends/
include/hammer/backends/contextfree.h
include/hammer/backends/regex.h
include/hammer/glue.h
include/hammer/hammer.h
include/hammer/internal.h
include/hammer/parsers/
include/hammer/parsers/parser_internal.h
lib/libhammer.a
lib/pkgconfig/
lib/pkgconfig/libhammer.pc