1Building libpsl with Visual Studio 2================================== 3 4Building libpsl for Windows using Visual Studio 2008 or later is 5supported with NMake (from release tarballs) or Meson (from GIT 6checkouts). The following sections will cover building libpsl with 7these methods. 8 9Currently, for builtin/runtime public suffix list (PSL) IDNA handling, 10only ICU is supported for Visual Studio builds. 11 12Using NMake (from a release tarball) 13=========== 14You will need a Python 2.7.x or later installation in order to 15complete the build successfully. 16 17You will need the ICU (International Components for Unicode) 18libraries, headers and DLLs, to build libpsl, unless both 19DISABLE_BUILTIN=1 and DISABLE_RUNTIME=1 are passed into the NMake 20command line as listed below. 21 22You can also buid libpsl with libiconv and gettext support, please 23see the options below for enabling such support. 24 25In a Visual Studio command prompt which matches your desired 26configuration (x86/Win32, x64 etc.), 27go to $(srcroot)\msvc, and issue the following command: 28 29nmake /f Makefile.vc CFG=[debug|release] 30 31A 'test' target is provided to build the test programs, while a 32'clean' target is provided to remove all the compiled and generated 33files for the build. An 'install' target is provided to copy the 34build PSL DLL, .lib and executables, as well as the related PDB files 35and libpsl header, into appropriate locations under PREFIX (please see 36below). 37 38This will build the libpsl DLL/LIB and the psl.exe utility in the 39vsX\$(CFG)\$(ARCH) subdirectory, where X is the release version 40of Visual Studio, such as 9 for 2008 and 16 for 2019, and ARCH is 41Win32 for 32-bit builds and x64 for 64-bit (x86_64) builds. 42 43A number of options can be passed into the NMake command, as follows. 44Enable by setting each option to 1, unless otherwise indicated: 45 46* PSL_FILE: Location of the PSL data file, which is retrieved from 47 https://publicsuffix.org/list/public_suffix_list.dat, 48 or some other custom location (not supported). Default 49 is in $(srcroot)\list\public_suffix_list.dat. This is 50 needed to generate the suffixes_dafsa.h header required 51 for the build, as well as the binary and ascii dafsa 52 files used for the test programs. 53 54* TEST_PSL_FILE: Location of the test PSL file. Default is in 55 $(srcroot)\list\tests\tests.txt. This is 56 required for building and running the test 57 programs. 58 59* STATIC: Set if building static versions of libpsl is desired. 60 61* USE_LIBTOOL_DLLNAME: Set to use libtool-style DLL naming. 62 63* DISABLE_RUNTIME: Do not use ICU to generate runtime PSL data. 64 65* DISABLE_BUILTIN: Do not use ICU to generate builtin PSL data. 66 67* USE_ICONV: Enable libiconv support, requires libiconv. 68 69* USE_GETTEXT: Enable gettext support for displaying i18n messages. 70 Implies USE_ICONV, and requires gettext-runtime. 71 72* PYTHON: Full path to a Python 2.7.x (or later) interpreter, if not 73 already in your PATH. 74 Required to generate DAFSA headers and data files that is 75 needed for the build, as well as generating pkg-config 76 files for NMake builds. 77 78* PREFIX: Base installation path of the build. Note that any dependent 79 libraries are searched first from the include\ and lib\ 80 sub-directories in PREFIX before searching in the paths 81 specified by %INCLUDE% and %LIB%. Default is 82 $(srcroot)\..\vsX\$(PLATFORM), where X is the release version 83 of Visual Studio, such as 9 for 2008 and 16 for 2019, 84 $(PLATFORM) is the target platform (Win32/x64) of the build. 85 86Building libpsl with Meson 87========================== 88Building using Meson is now supported for Visual Studio builds from a 89GIT checkout. 90 91Besides the requirements listed in the NMake builds, you will also need 92 93* Python 3.5.x or later 94* Meson build system, use PIP to install from Python 3.5.x64 95* Ninja build tool (if not involking Meson with --backend= 96 vs[2010|2015|2017|2019]) 97* A compatible PSL data file and a test PSL data file. You may 98 consider using the ones shipped with the latest libpsl release 99 tarball and place the PSL data file in $(srcroot)/list and the 100 test PSL data file in $(srcroot)/list/tests. You may also choose 101 to download the latest PSL data file from 102 https://publicsuffix.org/list/public_suffix_list.dat and place it 103 it $(srcroot)/list. Alternatively, specify 104 -Dpsl_file=<path_to_psl_data_file> and/or 105 -Dpsl_testfile=<path_to_test_psl_data_file> when invoking Meson. 106 107Open a Visual Studio command prompt and enter an empty build directory. 108 109Your Python interpreter, Meson executable script and Ninja (if used) 110need to be in your PATH. 111 112Any dependent libraries that are being used should have their headers 113found in paths specified by %INCLUDE% and their .lib files in the 114paths specified by %LIB%. 115 116In the empty build directory, run the following: 117 118meson <path_to_libpsl_git_checkout> --buildtype=... --prefix=<some_prefix> [--backend=vs[2010|2015|2017|2019]] 119 120Please see the Meson documentation for the values accepted by 121--buildtype. --backend=vsXXXX generates the corresponding versions 122of the Visual Studio solution files to build libpsl, which 123will elimnate the need to have the Ninja build tool installed. 124 125When the Meson configuration completes, run 'ninja' or open the 126generated solution files with Visual Studio and build the projects 127to carry out the build. Run 'ninja test' or the test project to 128test the build and run 'ninja install' or 'ninja install' to 129install the build results. 130 131If building with Visual Studio 2008, run the following after running 132'ninja install' in your builddir: 133 134for /r %f in (*.dll.manifest) do if exist $(prefix)\bin\%~nf mt /manifest %f /outputresource:$(prefix)\bin\%~nf;2 135 136for /r %f in (*.exe.manifest) do if exist $(prefix)\bin\%~nf mt /manifest %f /outputresource:$(prefix)\bin\%~nf;1 137 138So that the application manifests get properly embedded.