Commit Graph

246 Commits

Author SHA1 Message Date
Loïc Yhuel aa4909766c Make builtin option independant from runtime one
Since commit deabd4a, psl2c has been replaced by psl-make-dafsa.
The builtin PSL data is always generated the same way, and the value of the builtin
configure option does not matter anymore.

The built-in data is now embedded by default (instead of the previous "auto"), unless
explicitly disabled by --disable-builtin/-Dbuiltin=false.

When not using an run-time runtime IDNA library (--disable-runtime/-Druntime=no), libpsl can
now include the built-in data without any build-time dependency.
2022-06-06 22:48:32 +02:00
Tim Rühsen 6a82bcbc2a Fix comments from C++ to C/C++ in psl-make-dafsa 2022-06-06 12:32:17 +02:00
Ievgenii Meshcheriakov 9d39483d42 Remove definition of _GCC_VERSION_AT_LEAST
This macro is unused and is the only piece for compiler-specific
code in this file.
2022-02-18 16:57:35 +01:00
Tim Rühsen 21d2d51911 Avoid 'NULL + 1' as it is UB 2022-01-16 12:55:51 +01:00
Tim Rühsen 55d0ae04de Avoid 8bit overflow in is_public_suffix() 2022-01-16 12:51:33 +01:00
Tim Rühsen 1023a9ad12 Fix stack buffer overflow WRITE 1 in domain_to_punycode()
Reported-by: oss-fuzz (issue 39424 and issue 39226)

The affected code would only be built into the library when
configured to build without any IDNA library.
2022-01-15 22:38:36 +01:00
Alexey Rochev ba6f11f751 meson: automatically add PSL_STATIC define when building Windows static library 2022-01-13 01:54:38 +03:00
Alexey Rochev 02c8476071 Use C++ linker when building with libicu
ICU is a C++ library, event though it has C interface.
Therefore we have to use C++ linker when linking with it.
2022-01-07 01:12:17 +03:00
Alexey Rochev 0ecc788797 Remove meson.build generation and separate project and library versions in their own files
Project and library version are now stored in
version.txt and libtool_version_info.txt files respectively.
Both autotools and meson get their versioning information from this files.
Meson additionally automatically transforms library version
from libtool's own format.

Also raise meson version requirement from 0.47 to 0.57 which
is required by these changes.
2022-01-06 03:02:33 +03:00
Tim Rühsen f5035b854b Add WSAStartup() for Windows psl tool and tests.
As reported at https://github.com/rockdaboot/libpsl/issues/173,
psl_is_cookie_domain_acceptable() doesn't work properly without
WSAStartup() on Windows.

Co-authored-by: gvanem@yahoo.no
2021-11-26 19:10:37 +01:00
Tim Rühsen b2625f93f2 Fix write buffer overflow by 1 in domain_to_punycode()
This issue has been triggered after the previous commit increased
the size of label_buf.

It has been found by OSS-Fuzz (issue 39226).
The testcase is included into the unit tests.
2021-09-26 18:02:04 +02:00
Tim Rühsen 304ca77522 Increase label size from 48 -> 128 2021-09-18 12:24:45 +02:00
Tim Rühsen 99e7e6a2af
Merge pull request #166 from quink-black/fix-build-iconv
Add libiconv dep to meson build again
2021-01-16 18:07:35 +01:00
Erica Ehrhardt 62081a021f Meson: install libpsl man page, DAFSA builder
Partially addresses issue #136,
at least when building from a distribution tarball.
2021-01-14 17:13:46 -08:00
Zhao Zhili 5b63816e82 Add libiconv dep to meson build again
Build success on macOS and ubuntu.
2021-01-07 20:59:17 +08:00
Tim-Philipp Müller 8e02c2c4f1 meson: fix build
src/meson.build:19:0: ERROR: Unknown variable "libiconv".
2020-10-26 10:46:53 +00:00
Chris Hiszpanski 079e8d0f6c Add libiconv dep to meson build 2020-09-20 04:57:12 -07:00
Tomasz Kłoczko 47bab910ee Install psl executable and man pages.
Resolve #156
2020-08-05 18:38:11 +01:00
Nirbheek Chauhan 0c11bf19df meson: Fix running of psl-make-dafsa on Windows
`find_program()` evaluates to `python psl-make-dafsa` on Windows, so
running it with `python` evaluates to `python python psl-make-dafsa`,
causing this error on Windows:

```
"c:/python38/python.exe" "python" "C:/projects/repos/libpsl/src/psl-make-dafsa" "--output-format=binary" "C:/projects/repos/libpsl/list/public_suffix_list.dat" "tests/psl.dafsa"
c:/python38/python.exe: can't open file 'python': [Errno 2] No such file or directory
```
2020-04-06 20:18:45 +05:30
Matthew Waters a10c374dad meson: run python script against the meson version of python
Avoids using a python that may not exist in a python3 only distribution:

/usr/bin/env: ‘python’: No such file or directory
2020-04-02 15:16:20 +11:00
Tim Rühsen b9a190264f psl.c: Include strings.h only if it is available 2020-03-10 15:16:25 +01:00
Tim Rühsen d26a0acfd7
Merge pull request #148 from nirbheek/meson-port
meson: Use libtool library versioning, same as autotools
2020-02-28 14:01:36 +01:00
Nirbheek Chauhan 841ae6dddd meson: Use libtool library versioning, same as autotools
This helps maintain ABI compatibility with the Autotools build so it's
a drop-in replacement.
2020-02-28 13:20:23 +05:30
Tim Rühsen fca622f587 Include string.h in src/psl.c 2020-02-01 17:04:36 +01:00
Ross Burton b4fec5d0dd Makefile.am: use PYTHON when invoking psl-make-dafsa
In an environment where only Python 3 is installed, configure.ac finds and sets
PYTHON=python3 correctly but src/psl-make-dafsa is called directly, so the hashbang of
`#!/usr/bin/env python` is used which doesn't exist.

Fix this by explicitly running $(PYTHON) when using the tool.
2019-07-11 17:47:11 +01:00
Xavier Claessens 93e3bb3e29 Fix build when langinfo.h is not found 2019-06-03 15:52:48 -04:00
Tim Rühsen 999f28cc15 Use %NULL and %FILE overall in gtk-docs 2019-05-26 18:01:50 +02:00
Tim Rühsen 94a7e7c6ed Include meson build files into tarball 2019-04-17 12:05:00 +02:00
Jakub Adam c230a7b48b Windows: MSVC doesn't define ssize_t 2019-04-05 13:15:34 +02:00
carlo-bramini 7dcb69eb1d Windows: decrease minimum version to NT2000
Use WSAStringToAddressW() instead of inet_pton()

Undefine _WIN32_WINNT before (re)define it.
Fix if this macro is already declared somewhere.

Just add Winsock, no need to test anymore.

The number of characters must be used.

Use countof() macro instead

Improved fixes for Windows
2019-03-26 12:04:22 +01:00
Ignacio Casal Quinteiro 726d6773d4 meson: install the library 2018-12-31 17:01:00 +01:00
Tim Rühsen c9315f26bc Fix typos 2018-12-28 19:44:39 +01:00
Chun-wei Fan df873db543 meson: Ensure things build with Windows
We must link to ws2_32.lib for all Windows builds, and we need to use
workarounds for alloca() and snprintf() since Visual Studio uses
_alloca() for alloca() and provides snprintf() only on Visual Studio
2015 or later, meaning that we need to use _snprintf() here.

Also fix the parts where we run the Python scripts to generate items,
since those scripts already have shebang lines for Meson to pick up.
2018-12-11 09:28:51 +08:00
Xavier Claessens 77c10beab7 Add initial Meson build system 2018-12-07 09:54:20 -05:00
Xavier Claessens 1653897a49 Rename suffixes_dafsa.c to suffixes_dafsa.h
It is a generated file that we #include, so it makes more sense to have
.h extension. Also Meson tries to compile that file if it has .c
extension.
2018-12-06 09:11:02 -05:00
Tim Rühsen 9eedf5f246 Fix code broken by 2nd last patch 2018-10-29 14:56:27 +01:00
Tim Rühsen 1e1b9f5748 src/psl.c: Use C99 compliant defines 2018-10-29 13:17:59 +01:00
Tim Rühsen 9dba7e4f4c Use more C99 compliant file-scope variables 2018-10-29 12:16:52 +01:00
Tim Rühsen 8ee5c0993f Fix some issues found by lgtm.com 2018-10-15 17:40:29 +02:00
Tim Rühsen ab893d4e23 Rename _PSL_* macros to be POSIX compliant
Reported-by: Marc Lehmann
2018-10-14 20:24:45 +02:00
Tim Rühsen e87d463d04 Remove NLS / gettext from library code 2018-10-13 22:37:00 +02:00
Tim Rühsen e1104c58f3 Remove redundant code in _psl_is_public_suffix()
Reported-by: Marc Lehmann
2018-10-13 22:24:05 +02:00
Tim Rühsen 9d064cace8 Update to latest Public Suffix List 2018-10-07 21:15:07 +02:00
Tim Rühsen d691a3b941 Add Windows compatibility to fopen 2018-10-05 20:47:26 +02:00
Tim Rühsen b77d54469e Fix and cleanup build 2018-04-30 15:14:17 +02:00
Tim Rühsen a6397a0d62 Remove _HIDDEN from src/lookup_string_in_fixed_set.c 2018-04-26 16:45:15 +02:00
Chun-wei Fan 6a5da68ccf Add NMake Makefiles for Visual Studio builds
This adds a set of Visual Studio NMake Makefiles that can be used to
build libpsl, either as a DLL or as a static .lib.  Building of the psl
tool and the tests in tests/ (but not fuzz, since those tests use
fmemopen(), that is not supported on Windows) are also supported.

A simplified "install" target is provided that copies the build
results to a default or set prefix with the pkg-config file so that
other packages (such as libsoup) with build systems that depend on this
.pc file can be built.

These files make use of autotools stuff so that they have the up-to-date
version info upon a release.

Currently, only builds using the ICU runtime/builtin or with no
runtime/builtin are supported with Visual Studio builds.
2018-04-26 17:09:28 +08:00
Tim Rühsen 1a59430862 Add LTLIBICONV and LTLIBINTL to libpsl build 2018-04-25 16:00:12 +02:00
Tim Rühsen 64db5a57da Add support for native Win32 builds 2018-04-25 15:56:00 +02:00
Tim Rühsen b220ffb0b9 Fix MinGW cros build on Linux 2018-04-21 11:30:22 +02:00