blob: 8bbb375bfb80a5467554490d7f360f7d74f0993a [file] [log] [blame]
Ebrahim Byagowi4fc61892020-04-21 12:19:16 +04301#!/usr/bin/env python3
2
Ebrahim Byagowia7e82e42020-07-04 12:04:41 +04303"This tool is intended to be used from meson"
4
Ebrahim Byagowi45d9e8d2020-07-13 19:25:53 +04305import os, os.path, sys, subprocess, shutil
Ebrahim Byagowi4fc61892020-04-21 12:19:16 +04306
Khaled Hosny22cbd032021-09-14 12:34:25 +02007ragel = sys.argv[1]
Ebrahim Byagowi4fc61892020-04-21 12:19:16 +04308if not ragel:
Ebrahim Byagowi6a2b0ba2020-07-04 14:45:15 +04309 sys.exit ('You have to install ragel if you are going to develop HarfBuzz itself')
Ebrahim Byagowi4fc61892020-04-21 12:19:16 +043010
Ebrahim Byagowi785a9a82020-07-04 02:08:30 +043011if len (sys.argv) < 4:
Ebrahim Byagowi6a2b0ba2020-07-04 14:45:15 +043012 sys.exit (__doc__)
Ebrahim Byagowi4fc61892020-04-21 12:19:16 +043013
Khaled Hosny22cbd032021-09-14 12:34:25 +020014OUTPUT = sys.argv[2]
15CURRENT_SOURCE_DIR = sys.argv[3]
16INPUT = sys.argv[4]
Ebrahim Byagowie3af5292020-05-23 22:13:32 +043017
Ebrahim Byagowi785a9a82020-07-04 02:08:30 +043018outdir = os.path.dirname (OUTPUT)
19shutil.copy (INPUT, outdir)
20rl = os.path.basename (INPUT)
21hh = rl.replace ('.rl', '.hh')
Behdad Esfahbod13c6ad92021-06-12 11:00:19 -060022subprocess.Popen (ragel.split() + ['-e', '-F1', '-o', hh, rl], cwd=outdir).wait ()
Ebrahim Byagowie3af5292020-05-23 22:13:32 +043023
Ebrahim Byagowi785a9a82020-07-04 02:08:30 +043024# copy it also to src/
25shutil.copyfile (os.path.join (outdir, hh), os.path.join (CURRENT_SOURCE_DIR, hh))