diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2023-11-06 14:01:20 -0800 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2023-11-08 11:54:23 -0800 |
commit | c9411b1271ab87bd7004ed461f2021e8bc87ca2f (patch) | |
tree | 80d6f6faf8d90dca5ac2acc05fdd186b35b2b9c8 | |
parent | 4d05dc49a1d96dd1f0d1c36e34554f7c55b3f9bd (diff) |
Add a meson build system
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
-rw-r--r-- | .gitlab-ci.yml | 66 | ||||
-rw-r--r-- | Makefile.am | 8 | ||||
-rw-r--r-- | large/meson.build | 36 | ||||
-rw-r--r-- | meson.build | 94 | ||||
-rw-r--r-- | meson_options.txt | 10 | ||||
-rw-r--r-- | mkencodingsdir.in | 10 |
6 files changed, 219 insertions, 5 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ff45714..9d2af02 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -4,7 +4,7 @@ # Please see the ci-templates documentation for details: # https://freedesktop.pages.freedesktop.org/ci-templates/ -.templates_sha: &template_sha 34f4ade99434043f88e164933f570301fd18b125 # see https://docs.gitlab.com/ee/ci/yaml/#includefile +.templates_sha: &template_sha 185ede0e9b9b1924b92306ab8b882a6294e92613 # see https://docs.gitlab.com/ee/ci/yaml/#includefile include: @@ -29,8 +29,8 @@ variables: # The tag should be updated each time the list of packages is updated. # Changing a tag forces the associated image to be rebuilt. # Note: the tag has no meaning, we use a date format purely for readability - FDO_DISTRIBUTION_TAG: '2023-02-15.0' - FDO_DISTRIBUTION_PACKAGES: 'git gcc pkgconf autoconf automake make xorg-util-macros xorg-font-util xorg-mkfontscale' + FDO_DISTRIBUTION_TAG: '2023-11-03.1' + FDO_DISTRIBUTION_PACKAGES: 'git gcc pkgconf autoconf automake make meson ninja jq xorg-util-macros xorg-font-util xorg-mkfontscale' # @@ -82,7 +82,7 @@ container-prep: # # The default build, runs on the image built above. # -build: +autotools: stage: build extends: - .fdo.distribution-image@arch @@ -93,5 +93,63 @@ build: - ../configure --disable-silent-rules - make - make check + - make install - make distcheck + - mv encodings*.tar.gz .. - popd > /dev/null + artifacts: + paths: + - encodings*.tar.gz + +meson: + extends: + - .fdo.distribution-image@arch + stage: build + script: + - mkdir -p ../_inst + - meson setup builddir --prefix="$PWD/../_inst" + - meson install -C builddir + +meson from tarball: + extends: + - .fdo.distribution-image@arch + stage: test + script: + - mkdir -p _tarball_build + - tar xf encodings-*.tar.gz -C _tarball_build + - pushd _tarball_build/encodings-* + - meson setup builddir + - meson install -C builddir + needs: + - autotools + variables: + GIT_STRATEGY: none + +compare meson and autotools: + extends: + - .fdo.distribution-image@arch + stage: test + script: + - mkdir -p $PWD/_meson_inst + - mkdir -p $PWD/_autotools_inst + # the prefix ends up in the pkgconfig files, so we use a symlink + # to use the same --prefix for meson and autotools + - ln -sf $PWD/_meson_inst $PWD/_inst + - meson setup builddir --prefix=$PWD/_inst + - meson install -C builddir + - rm $PWD/_inst + - ln -sf $PWD/_autotools_inst $PWD/_inst + - autoreconf -ivf + - ./configure --prefix=$PWD/_inst + - make && make install + - diff --brief --recursive $PWD/_meson_inst $PWD/_autotools_inst + +check versions are in sync: + extends: + - .fdo.distribution-image@arch + stage: test + script: + - autoreconf -ivf + - ./configure --version | head -n 1 | sed -e 's/encodings configure //' > autotools.version + - meson introspect meson.build --projectinfo | jq -r '.version' > meson.version + - diff -u autotools.version meson.version || (echo "ERROR - autotools and meson versions not in sync" && false) diff --git a/Makefile.am b/Makefile.am index aca32ab..a49d151 100644 --- a/Makefile.am +++ b/Makefile.am @@ -38,7 +38,13 @@ ENCODING_FILES = \ tis620-2.enc \ viscii1.1-1.enc -EXTRA_DIST = $(ENCODING_FILES) README.md +EXTRA_DIST = \ + $(ENCODING_FILES) \ + large/meson.build \ + meson.build \ + meson_options.txt \ + mkencodingsdir.in \ + README.md MAINTAINERCLEANFILES = ChangeLog INSTALL diff --git a/large/meson.build b/large/meson.build new file mode 100644 index 0000000..7195dcd --- /dev/null +++ b/large/meson.build @@ -0,0 +1,36 @@ +largeencodingsdir = encodingsdir / 'large' + +large_encoding_files = [ + 'big5.eten-0.enc', + 'big5hkscs-0.enc', + 'cns11643-1.enc', + 'cns11643-2.enc', + 'cns11643-3.enc', + 'gb18030-0.enc', + 'gb18030.2000-0.enc', + 'gb18030.2000-1.enc', + 'gb2312.1980-0.enc', + 'gbk-0.enc', + 'jisx0201.1976-0.enc', + 'jisx0208.1990-0.enc', + 'jisx0212.1990-0.enc', + 'ksc5601.1987-0.enc', + 'ksc5601.1992-3.enc', + 'sun.unicode.india-0.enc' +] + +if get_option('gzip-large-encodings') + foreach large_encoding_input : large_encoding_files + large_encoding_output = large_encoding_input + '.gz' + custom_target(large_encoding_output, + input: large_encoding_input, + output: large_encoding_output, + command: [gzip, '-c', '-n', '@INPUT@'], + capture: true, # capture output from stdout + install: true, + install_dir: largeencodingsdir) + endforeach +else + install_data(large_encoding_files, install_dir: largeencodingsdir) +endif + diff --git a/meson.build b/meson.build new file mode 100644 index 0000000..f467962 --- /dev/null +++ b/meson.build @@ -0,0 +1,94 @@ +project('encodings', + version: '1.0.7', + meson_version: '>= 0.58.0', + license: 'MIT' +) + +mkfontscale = find_program('mkfontscale', required: true, native: true) + +if get_option('gzip-small-encodings') or get_option('gzip-large-encodings') + gzip = find_program('gzip', required: true, native: true) +endif + +encodingsdir = get_option('encodingsdir') +if encodingsdir == '' + fontrootdir = get_option('fontrootdir') + if fontrootdir == '' + fontutil = dependency('fontutil', required: false, version: '>= 1.1.0') + if fontutil.found() + fontrootdir = fontutil.get_variable('fontrootdir') + endif + if fontrootdir == '' + fontrootdir = get_option('datadir') / 'fonts' / 'X11' + endif + endif + encodingsdir = fontrootdir / 'encodings' +endif + +small_encoding_files = [ + 'adobe-dingbats.enc', + 'adobe-standard.enc', + 'adobe-symbol.enc', + 'armscii-8.enc', + 'ascii-0.enc', + 'dec-special.enc', + 'ibm-cp437.enc', + 'ibm-cp850.enc', + 'ibm-cp852.enc', + 'ibm-cp866.enc', + 'iso8859-11.enc', + 'iso8859-13.enc', + 'iso8859-14.enc', + 'iso8859-16.enc', + 'iso8859-6.16.enc', + 'iso8859-6.8x.enc', + 'microsoft-cp1250.enc', + 'microsoft-cp1251.enc', + 'microsoft-cp1252.enc', + 'microsoft-cp1253.enc', + 'microsoft-cp1254.enc', + 'microsoft-cp1255.enc', + 'microsoft-cp1256.enc', + 'microsoft-cp1257.enc', + 'microsoft-cp1258.enc', + 'microsoft-win3.1.enc', + 'mulearabic-0.enc', + 'mulearabic-1.enc', + 'mulearabic-2.enc', + 'mulelao-1.enc', + 'suneu-greek.enc', + 'tcvn-0.enc', + 'tis620-2.enc', + 'viscii1.1-1.enc' +] + +if get_option('gzip-small-encodings') + foreach small_encoding_input : small_encoding_files + small_encoding_output = small_encoding_input + '.gz' + custom_target(small_encoding_output, + input: small_encoding_input, + output: small_encoding_output, + command: [gzip, '-c', '-n', '@INPUT@'], + capture: true, # capture output from stdout + install: true, + install_dir: encodingsdir) + endforeach +else + install_data(small_encoding_files, install_dir: encodingsdir) +endif + +subdir('large') + +conf_data = configuration_data({ + 'mkfontscale': mkfontscale.full_path(), + 'encodingsdir': encodingsdir +}) +mkencodingsdir = configure_file(input : 'mkencodingsdir.in', + output : 'mkencodingsdir', + configuration : conf_data) +meson.add_install_script(mkencodingsdir) + +summary({'encodingsdir': encodingsdir, + 'gzip-small-encodings': get_option('gzip-small-encodings'), + 'gzip-large-encodings': get_option('gzip-large-encodings'), + 'mkfontscale': mkfontscale}) diff --git a/meson_options.txt b/meson_options.txt new file mode 100644 index 0000000..dd853ff --- /dev/null +++ b/meson_options.txt @@ -0,0 +1,10 @@ +# Choose whether or not to compress encodings - default is to compress all +option('gzip-small-encodings', type: 'boolean', value: true, + description: 'gzip small encoding files') +option('gzip-large-encodings', type: 'boolean', value: true, + description: 'gzip large encoding files') +# options for setting the installation path +option('fontrootdir', type: 'string', + description: 'Path to root directory for font files') +option('encodingsdir', type: 'string', + description: 'Path to directory for encodings files') diff --git a/mkencodingsdir.in b/mkencodingsdir.in new file mode 100644 index 0000000..56816b7 --- /dev/null +++ b/mkencodingsdir.in @@ -0,0 +1,10 @@ +#! /bin/sh + +if [ -z ${MESON_INSTALL_QUIET+x} ]; then + set -x +fi + +cd ${DESTDIR}@encodingsdir@ +@mkfontscale@ -b -s -l -n -r -p @encodingsdir@ -e . -e large . +cd large +@mkfontscale@ -b -s -l -n -r -p @encodingsdir@/large -e . . |