Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create *.chs files in the output directory when specified. #250

Closed
XVilka opened this issue Mar 5, 2020 · 1 comment
Closed

Create *.chs files in the output directory when specified. #250

XVilka opened this issue Mar 5, 2020 · 1 comment

Comments

@XVilka
Copy link

XVilka commented Mar 5, 2020

I use the following way to produce Haskell bindings:

def gen_haskell_bindings(outdir, path):
    def gen_chs(fname):
        return chs.format(radare2_includedir, fname)

    fname = os.path.splitext(os.path.basename(path))[0]
    cpp_opts = " ".join(r2_includes)
    tmpchs = gen_chs(fname + ".h")
    tmpfname = fname + ".chs"
    tmpf = open(tmpfname, "w")
    tmpf.write(tmpchs)
    print("Writing CHS file: {0}".format(tmpfname))
    cmdline = "c2hs -d trace -d genbind -d ctrav -k -t {0} -C \"{1}\" {2}".format(outdir, cpp_opts, tmpfname)
    # print(cmdline)
    # set PKG_CONFIG_PATH
    pkgenv = set_pkgconfig(radare2_libdir)
    # TODO: Check return code
    call(cmdline, shell=True, env=pkgenv)
    tmpf.close()
    return True

where c2hs -d trace -d genbind -d ctrav -k -t /out/dir -C "..." is the actual command. C2hs creates *.chs files in the current directory while *.chs.h and *.hs files in the output. But it fails to produce meaningful *.hs files because it can't find the *.chs files. Maybe it makes sense to put them in the same output directory as well?

@XVilka
Copy link
Author

XVilka commented Mar 24, 2020

Sorry, was my mistake.

@XVilka XVilka closed this as completed Mar 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant