2015-12-01 18:07:30 +00:00
|
|
|
#/bin/sh
|
2020-03-06 10:43:58 +00:00
|
|
|
echo This script requires that python-ctypeslib is installed on the system
|
|
|
|
echo Unfortunately, this package is long unmaintained and only available on Debian8
|
|
|
|
echo
|
|
|
|
|
2020-09-09 17:37:36 +00:00
|
|
|
# If your distro doesn't provide python-ctypeslib:
|
|
|
|
# svn co "https://svn.python.org/projects/ctypes/trunk/ctypeslib/"
|
|
|
|
# cd ctypeslib
|
|
|
|
# python2 ./setup.py install --prefix /tmp/out
|
|
|
|
# ln -s h2xml.py /tmp/out/bin/h2xml
|
|
|
|
# ln -s xml2py.py /tmp/out/bin/xml2py
|
|
|
|
# export PYTHONPATH="$PYTHONPATH:/tmp/out/lib/python2.7/site-packages"
|
|
|
|
# export PATH="$PATH:/tmp/out/bin/"
|
|
|
|
# ./regen-mncc-py.sh
|
|
|
|
# == Troubleshooting:
|
|
|
|
# * h2ml: Failing with tracebak OSError Not found:
|
|
|
|
# One may be missing gccxml. On arch, install gccxml-git from AUR.
|
|
|
|
# * h2xml failing due to missing gccxml_builtins.h:
|
|
|
|
# Create empty file /tmp/include/gccxml_builtins.h and pass "-I /tmp/include/" to h2xml.
|
|
|
|
# * Missing __builtin_bswap16/32/64:
|
|
|
|
# Copy from /usr/include/bits/byteswap.h defines __bswap_constant_16/32/64 to
|
|
|
|
# either start of mncc.h itself or /tmp/include/gccxml_builtins.h, and rename
|
|
|
|
# them as __builtin_bswap16/32/64.
|
|
|
|
|
2020-03-06 10:43:58 +00:00
|
|
|
if [ ! -x `which h2xml` ]; then
|
|
|
|
echo No h2xml executable found - python-ctypeslib not installed?
|
2020-09-09 17:37:36 +00:00
|
|
|
exit 1
|
2020-03-06 10:43:58 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ ! -x `which xml2py` ]; then
|
|
|
|
echo No xml2py executable found - python-ctypeslib not installed?
|
2020-09-09 17:37:36 +00:00
|
|
|
exit 1
|
2020-03-06 10:43:58 +00:00
|
|
|
fi
|
|
|
|
|
2020-09-09 17:37:36 +00:00
|
|
|
set -xe
|
2015-12-01 18:07:30 +00:00
|
|
|
cp ./mncc.h /tmp/mncc.h
|
2020-09-09 17:37:36 +00:00
|
|
|
h2xml -I /tmp/include/ ./mncc.h -c -o mncc.xml
|
2020-03-06 10:43:58 +00:00
|
|
|
xml2py mncc.xml -k dest -v -o mncc.py
|