Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
48 lines (39 sloc) 1.3 KB
import std/[os, strutils, strformat, osproc]
import nimterop/[cimport, git, paths]
const
baseDir = currentSourcePath.parentDir() / ".." / "build"
srcDir = baseDir / "smenu"
smenuVer = "v0.9.15"
soFile = srcDir / "smenu.so"
static:
cDebug()
cDisableCaching()
gitPull("https://github.com/p-gen/smenu",
checkout=smenuVer,
outdir=srcDir)
configure(srcDir, "config.h")
let
(_, retCode) = gorgeEx(&"cd {srcDir} && build.sh")
if retCode != 0:
echo &"[Error] Running '{srcDir}/build.sh' failed."
quit QuitFailure
mvFile(srcDir / "smenu", soFile)
discard gorge(&"cd {srcDir} && make clean")
cIncludeDir(srcDir)
cPlugin:
import strutils
# Symbol renaming examples
proc onSymbol*(sym: var Symbol) {.exportc, dynlib.} =
# Get rid of leading and trailing underscores
sym.name = sym.name.strip(chars = {'_'})
# # Remove prefixes or suffixes from procs
# if sym.kind == nskProc and sym.name.contains("SDL_"):
# sym.name = sym.name.replace("SDL_", "")
cOverride:
type
regex_t = object # The compiled smenu.so will use the regex_t from regex.h
# Here we are just silencing the Nim compiler by declaring
# the regex_t type.
langinfo_t = object
ll_t = object
cImport(srcDir / "smenu.h", recurse=true)
You can’t perform that action at this time.