Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@naveen521kk
Last active May 9, 2021 19:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save naveen521kk/f6ae5e415ca9650dc08d48503d2fd645 to your computer and use it in GitHub Desktop.
Save naveen521kk/f6ae5e415ca9650dc08d48503d2fd645 to your computer and use it in GitHub Desktop.
Kpathsea compile meson windows
import sys
normal_headers = [
"absolute.h",
"c-ctype.h",
"c-dir.h",
"c-errno.h",
"c-fopen.h",
"c-limits.h",
"c-memstr.h",
"c-minmax.h",
"c-namemx.h",
"c-pathch.h",
"c-pathmx.h",
"c-proto.h",
"c-stat.h",
"c-std.h",
"c-unistd.h",
"cnf.h",
"concatn.h",
"debug.h",
"expand.h",
"getopt.h",
"hash.h",
"lib.h",
"line.h",
"magstep.h",
"pathsearch.h",
"proginit.h",
"progname.h",
"readable.h",
"str-list.h",
"str-llist.h",
"systypes.h",
"tex-file.h",
"tex-glyph.h",
"tex-hush.h",
"tex-make.h",
"types.h",
"variable.h",
"version.h",
]
normal_headers.extend(["config.h", "c-auto.h", "paths.h"])
with open(sys.argv[1], "w", encoding="utf-8") as f:
f.write("/* This is a generated file */")
f.write("/* collecting all public kpathsea headers. */")
for file in normal_headers:
f.write(f"#include <kpathsea/{file}>")
project(
'kpathsea', 'c',
version: '6.2.0',
default_options: [
'warning_level=1',
'buildtype=release',
])
cc = meson.get_compiler('c')
main_c_args = []
if cc.get_id() == 'msvc'
main_c_args += [
'-DHAVE_CONFIG_H',
'-DWIN32=1',
'-DMAKE_KPSE_DLL=1',
'-D_CRT_SECURE_NO_DEPRECATE',
'-DEXEEXT=".exe"'
]
endif
main_c_args = cc.get_supported_arguments(main_c_args)
sources = [
'tex-file.c',
'absolute.c',
'atou.c',
'cnf.c',
'concat.c',
'concat3.c',
'concatn.c',
'db.c',
'debug.c',
'dir.c',
'elt-dirs.c',
'expand.c',
'extend-fname.c',
'file-p.c',
'find-suffix.c',
'fn.c',
'fontmap.c',
'getopt.c',
'getopt1.c',
'hash.c',
'kdefault.c',
'kpathsea.c',
'line.c',
'magstep.c',
'make-suffix.c',
'path-elt.c',
'pathsearch.c',
'proginit.c',
'progname.c',
'readable.c',
'rm-suffix.c',
'str-list.c',
'str-llist.c',
'tex-glyph.c',
'tex-hush.c',
'tex-make.c',
'tilde.c',
'uppercasify.c',
'variable.c',
'version.c',
'xbasename.c',
'xcalloc.c',
'xdirname.c',
'xfopen.c',
'xfseek.c',
'xftell.c',
'xgetcwd.c',
'xmalloc.c',
'xopendir.c',
'xputenv.c',
'xrealloc.c',
'xstat.c',
'xstrdup.c',
'dirent.c',
'knj.c',
'win32lib.c'
]
win_deps = [
cc.find_library('user32'),
cc.find_library('advapi32'),
cc.find_library('shell32')
]
kpathsealib = library(
'kpathsealib',
sources,
c_args: main_c_args,
install: true,
include_directories: ['.','..','./..'],
dependencies: win_deps,
)
executable(
'kpsewhich',
['kpsewhich.c','version.c','getopt.c'],
c_args: main_c_args,
install: true,
include_directories: ['.','..','./..'],
link_with: kpathsealib,
)
executable(
'kpsestat',
['kpsestat.c'],
c_args: main_c_args,
install: true,
include_directories: ['.','..','./..'],
link_with: kpathsealib,
)
executable(
'access',
['access.c'],
c_args: main_c_args,
install: true,
include_directories: ['.','..','./..'],
link_with: kpathsealib,
)
executable(
'readlink',
['readlink.c'],
c_args: main_c_args,
install: true,
include_directories: ['.','..','./..'],
link_with: kpathsealib,
)
# now install headers
normal_headers = [
'absolute.h',
'c-ctype.h',
'c-dir.h',
'c-errno.h',
'c-fopen.h',
'c-limits.h',
'c-memstr.h',
'c-minmax.h',
'c-namemx.h',
'c-pathch.h',
'c-pathmx.h',
'c-proto.h',
'c-stat.h',
'c-std.h',
'c-unistd.h',
'cnf.h',
'concatn.h',
'debug.h',
'expand.h',
'getopt.h',
'hash.h',
'lib.h',
'line.h',
'magstep.h',
'pathsearch.h',
'proginit.h',
'progname.h',
'readable.h',
'str-list.h',
'str-llist.h',
'systypes.h',
'tex-file.h',
'tex-glyph.h',
'tex-hush.h',
'tex-make.h',
'types.h',
'variable.h',
'version.h',
]
special_headers=[
'config.h',
'knj.h',
'mingw32.h',
'win32lib.h'
]
prog_python = import('python').find_installation('python')
kpseheaders = custom_target(
'kpathsea.h',
output : 'kpathsea.h',
input : 'gen-headers.py',
command : [prog_python,'gen-headers.py', '@OUTPUT@'],
)
install_headers(normal_headers+special_headers+['kpathsea.h'],subdir : 'kpathsea')
# pkgconfig work
# useful
pkg = import('pkgconfig')
pkg.generate(
kpathsealib,
filebase: 'kpathsea',
description: 'Kpathsea filename lookup library')
@naveen521kk
Copy link
Author

Only sources from W32TeX will work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment