Richard Hughes | cb97368 | 2018-12-19 11:44:22 +0000 | [diff] [blame] | 1 | project('flashromutils', 'c', |
Samuel R. Messner | 21bcfa9 | 2022-02-17 06:17:31 +0100 | [diff] [blame] | 2 | version : run_command('util/getversion.sh', '--version').stdout().strip(), |
Nico Huber | b417c0c | 2019-09-24 22:12:40 +0200 | [diff] [blame] | 3 | license : 'GPL-2.0', |
Angel Pons | 3064943 | 2021-01-26 10:21:46 +0100 | [diff] [blame] | 4 | meson_version : '>=0.50.0', |
Richard Hughes | cb97368 | 2018-12-19 11:44:22 +0000 | [diff] [blame] | 5 | default_options : ['warning_level=2', 'c_std=c99'], |
| 6 | ) |
| 7 | |
| 8 | # libtool versioning |
| 9 | lt_current = '1' |
| 10 | lt_revision = '0' |
| 11 | lt_age = '0' |
| 12 | lt_version = '@0@.@1@.@2@'.format(lt_current, lt_age, lt_revision) |
| 13 | |
Jacob Garber | 4a84ec2 | 2019-07-25 19:12:31 -0600 | [diff] [blame] | 14 | # hide/enable some warnings |
Richard Hughes | cb97368 | 2018-12-19 11:44:22 +0000 | [diff] [blame] | 15 | warning_flags = [ |
Jacob Garber | 4a84ec2 | 2019-07-25 19:12:31 -0600 | [diff] [blame] | 16 | '-Wwrite-strings', |
Richard Hughes | cb97368 | 2018-12-19 11:44:22 +0000 | [diff] [blame] | 17 | '-Wno-unused-parameter', |
Richard Hughes | cb97368 | 2018-12-19 11:44:22 +0000 | [diff] [blame] | 18 | '-Wno-address-of-packed-member', |
| 19 | '-Wno-enum-conversion', |
Richard Hughes | cb97368 | 2018-12-19 11:44:22 +0000 | [diff] [blame] | 20 | '-Wno-missing-braces', |
| 21 | ] |
| 22 | |
| 23 | conf = configuration_data() |
| 24 | |
| 25 | cc = meson.get_compiler('c') |
| 26 | add_project_arguments(cc.get_supported_arguments(warning_flags), language : 'c') |
| 27 | add_project_arguments('-D_DEFAULT_SOURCE', language : 'c') |
Rosen Penev | 566193f | 2020-07-18 12:50:16 -0700 | [diff] [blame] | 28 | add_project_arguments('-D_POSIX_C_SOURCE=200809L', language : 'c') # required for fileno, nanosleep, and strndup |
Richard Hughes | cb97368 | 2018-12-19 11:44:22 +0000 | [diff] [blame] | 29 | add_project_arguments('-D_BSD_SOURCE', language : 'c') # required for glibc < v2.19 |
| 30 | add_project_arguments('-DFLASHROM_VERSION="' + meson.project_version() + '"', language : 'c') |
| 31 | |
Thomas Heijligen | d6d96c1 | 2021-10-12 16:47:43 +0200 | [diff] [blame] | 32 | if host_machine.endian() == 'little' |
| 33 | add_project_arguments('-D__FLASHROM_LITTLE_ENDIAN__=1', language : 'c') |
| 34 | endif |
| 35 | if host_machine.endian() == 'big' |
| 36 | add_project_arguments('-D__FLASHROM_BIG_ENDIAN__=1', language : 'c') |
| 37 | endif |
| 38 | |
Thomas Heijligen | 847d94b | 2021-10-12 17:38:01 +0200 | [diff] [blame] | 39 | if host_machine.system() in ['cygwin', 'windows'] |
| 40 | add_project_arguments('-DIS_WINDOWS=1', language : 'c') |
| 41 | else |
| 42 | add_project_arguments('-DIS_WINDOWS=0', language : 'c') |
| 43 | endif |
| 44 | |
Thomas Heijligen | 433dc1c | 2021-10-12 17:58:35 +0200 | [diff] [blame] | 45 | if host_machine.system() in ['linux', 'darwin', 'netbsd', 'openbsd'] |
| 46 | add_project_arguments('-DUSE_IOPL=1', language : 'c') |
| 47 | else |
| 48 | add_project_arguments('-DUSE_IOPL=0', language : 'c') |
| 49 | endif |
| 50 | |
| 51 | if host_machine.system() in ['freebsd', 'dragonfly'] |
| 52 | add_project_arguments('-DUSE_DEV_IO=1', language : 'c') |
| 53 | else |
| 54 | add_project_arguments('-DUSE_DEV_IO=0', language : 'c') |
| 55 | endif |
| 56 | |
| 57 | if host_machine.system() in ['gnu'] |
| 58 | add_project_arguments('-DUSE_IOPERM=1', language : 'c') |
| 59 | else |
| 60 | add_project_arguments('-DUSE_IOPERM=0', language : 'c') |
| 61 | endif |
| 62 | |
Richard Hughes | cb97368 | 2018-12-19 11:44:22 +0000 | [diff] [blame] | 63 | # get defaults from configure |
| 64 | config_atahpt = get_option('config_atahpt') |
| 65 | config_atapromise = get_option('config_atapromise') |
| 66 | config_atavia = get_option('config_atavia') |
| 67 | config_buspirate_spi = get_option('config_buspirate_spi') |
| 68 | config_ch341a_spi = get_option('config_ch341a_spi') |
| 69 | config_dediprog = get_option('config_dediprog') |
| 70 | config_developerbox_spi = get_option('config_developerbox_spi') |
| 71 | config_digilent_spi = get_option('config_digilent_spi') |
Jean THOMAS | e28d8e4 | 2022-10-11 17:54:30 +0200 | [diff] [blame] | 72 | config_dirtyjtag_spi = get_option('config_dirtyjtag_spi') |
Richard Hughes | cb97368 | 2018-12-19 11:44:22 +0000 | [diff] [blame] | 73 | config_drkaiser = get_option('config_drkaiser') |
| 74 | config_dummy = get_option('config_dummy') |
| 75 | config_ft2232_spi = get_option('config_ft2232_spi') |
| 76 | config_gfxnvidia = get_option('config_gfxnvidia') |
| 77 | config_internal = get_option('config_internal') |
| 78 | config_it8212 = get_option('config_it8212') |
Marc Schink | 7ec2d63 | 2020-12-08 22:20:50 +0100 | [diff] [blame] | 79 | config_jlink_spi = get_option('config_jlink_spi') |
Richard Hughes | cb97368 | 2018-12-19 11:44:22 +0000 | [diff] [blame] | 80 | config_linux_mtd = get_option('config_linux_mtd') |
| 81 | config_linux_spi = get_option('config_linux_spi') |
| 82 | config_mstarddc_spi = get_option('config_mstarddc_spi') |
| 83 | config_nic3com = get_option('config_nic3com') |
| 84 | config_nicintel_eeprom = get_option('config_nicintel_eeprom') |
| 85 | config_nicintel = get_option('config_nicintel') |
| 86 | config_nicintel_spi = get_option('config_nicintel_spi') |
| 87 | config_nicnatsemi = get_option('config_nicnatsemi') |
| 88 | config_nicrealtek = get_option('config_nicrealtek') |
| 89 | config_ogp_spi = get_option('config_ogp_spi') |
| 90 | config_pickit2_spi = get_option('config_pickit2_spi') |
| 91 | config_pony_spi = get_option('config_pony_spi') |
| 92 | config_rayer_spi = get_option('config_rayer_spi') |
| 93 | config_satamv = get_option('config_satamv') |
| 94 | config_satasii = get_option('config_satasii') |
| 95 | config_serprog = get_option('config_serprog') |
| 96 | config_usbblaster_spi = get_option('config_usbblaster_spi') |
Miklós Márton | 324929c | 2019-08-01 19:14:10 +0200 | [diff] [blame] | 97 | config_stlinkv3_spi = get_option('config_stlinkv3_spi') |
Thomas Heijligen | 84e9c91 | 2021-06-01 16:22:14 +0200 | [diff] [blame] | 98 | config_default_programmer_name = get_option('default_programmer_name') |
| 99 | config_default_programmer_args = get_option('default_programmer_args') |
Daniel Campello | f7a84fd | 2021-03-16 17:17:14 -0600 | [diff] [blame] | 100 | config_print_wiki= get_option('print_wiki') |
Richard Hughes | cb97368 | 2018-12-19 11:44:22 +0000 | [diff] [blame] | 101 | |
| 102 | cargs = [] |
| 103 | deps = [] |
| 104 | srcs = [] |
| 105 | |
Richard Hughes | cb97368 | 2018-12-19 11:44:22 +0000 | [diff] [blame] | 106 | need_raw_access = false |
| 107 | need_serial = false |
| 108 | |
| 109 | # check for required symbols |
| 110 | if cc.has_function('clock_gettime') |
| 111 | add_project_arguments('-DHAVE_CLOCK_GETTIME=1', language : 'c') |
| 112 | endif |
| 113 | if cc.has_function('strnlen') |
| 114 | add_project_arguments('-DHAVE_STRNLEN=1', language : 'c') |
| 115 | endif |
| 116 | if cc.check_header('sys/utsname.h') |
| 117 | add_project_arguments('-DHAVE_UTSNAME=1', language : 'c') |
| 118 | endif |
| 119 | |
| 120 | # some programmers require libusb |
| 121 | if get_option('usb') |
| 122 | srcs += 'usbdev.c' |
| 123 | deps += dependency('libusb-1.0') |
| 124 | else |
| 125 | config_ch341a_spi = false |
| 126 | config_dediprog = false |
| 127 | config_digilent_spi = false |
Jean THOMAS | e28d8e4 | 2022-10-11 17:54:30 +0200 | [diff] [blame] | 128 | config_dirtyjtag_spi = false |
Richard Hughes | cb97368 | 2018-12-19 11:44:22 +0000 | [diff] [blame] | 129 | config_developerbox_spi = false |
Thomas Heijligen | b221cd7 | 2019-04-05 15:08:35 +0200 | [diff] [blame] | 130 | config_pickit2_spi = false |
Richard Hughes | cb97368 | 2018-12-19 11:44:22 +0000 | [diff] [blame] | 131 | endif |
| 132 | |
| 133 | # some programmers require libpci |
| 134 | if get_option('pciutils') |
| 135 | srcs += 'pcidev.c' |
| 136 | deps += dependency('libpci') |
Daniel Campello | 924e631 | 2021-03-17 09:14:11 -0600 | [diff] [blame] | 137 | need_raw_access = true |
Richard Hughes | cb97368 | 2018-12-19 11:44:22 +0000 | [diff] [blame] | 138 | cargs += '-DNEED_PCI=1' |
| 139 | else |
| 140 | config_atahpt = false |
| 141 | config_atapromise = false |
| 142 | config_atavia = false |
| 143 | config_drkaiser = false |
| 144 | config_gfxnvidia = false |
| 145 | config_internal = false |
| 146 | config_it8212 = false |
| 147 | config_nic3com = false |
| 148 | config_nicintel_eeprom = false |
| 149 | config_nicintel = false |
| 150 | config_nicintel_spi = false |
| 151 | config_nicnatsemi = false |
| 152 | config_nicrealtek = false |
| 153 | config_ogp_spi = false |
Richard Hughes | cb97368 | 2018-12-19 11:44:22 +0000 | [diff] [blame] | 154 | config_satamv = false |
| 155 | config_satasii = false |
| 156 | endif |
| 157 | |
| 158 | # set defines for configured programmers |
| 159 | if config_atahpt |
| 160 | srcs += 'atahpt.c' |
| 161 | cargs += '-DCONFIG_ATAHPT=1' |
| 162 | endif |
| 163 | if config_atapromise |
| 164 | srcs += 'atapromise.c' |
| 165 | cargs += '-DCONFIG_ATAPROMISE=1' |
| 166 | endif |
| 167 | if config_atavia |
| 168 | srcs += 'atavia.c' |
| 169 | cargs += '-DCONFIG_ATAVIA=1' |
| 170 | endif |
| 171 | if config_buspirate_spi |
| 172 | srcs += 'buspirate_spi.c' |
| 173 | cargs += '-DCONFIG_BUSPIRATE_SPI=1' |
| 174 | need_serial = true |
| 175 | endif |
| 176 | if config_ch341a_spi |
| 177 | srcs += 'ch341a_spi.c' |
| 178 | cargs += '-DCONFIG_CH341A_SPI=1' |
| 179 | endif |
| 180 | if config_dediprog |
| 181 | srcs += 'dediprog.c' |
| 182 | cargs += '-DCONFIG_DEDIPROG=1' |
| 183 | endif |
| 184 | if config_developerbox_spi |
| 185 | srcs += 'developerbox_spi.c' |
| 186 | cargs += '-DCONFIG_DEVELOPERBOX_SPI=1' |
| 187 | endif |
| 188 | if config_digilent_spi |
| 189 | srcs += 'digilent_spi.c' |
| 190 | cargs += '-DCONFIG_DIGILENT_SPI=1' |
| 191 | endif |
Jean THOMAS | e28d8e4 | 2022-10-11 17:54:30 +0200 | [diff] [blame] | 192 | if config_dirtyjtag_spi |
| 193 | srcs += 'dirtyjtag_spi.c' |
| 194 | cargs += '-DCONFIG_DIRTYJTAG_SPI=1' |
| 195 | endif |
Richard Hughes | cb97368 | 2018-12-19 11:44:22 +0000 | [diff] [blame] | 196 | if config_drkaiser |
| 197 | srcs += 'drkaiser.c' |
| 198 | cargs += '-DCONFIG_DRKAISER=1' |
| 199 | endif |
| 200 | if config_dummy |
| 201 | srcs += 'dummyflasher.c' |
| 202 | cargs += '-DCONFIG_DUMMY=1' |
| 203 | endif |
| 204 | if config_ft2232_spi |
| 205 | srcs += 'ft2232_spi.c' |
| 206 | cargs += '-DCONFIG_FT2232_SPI=1' |
| 207 | deps += dependency('libftdi1') |
| 208 | cargs += '-DHAVE_FT232H=1' |
| 209 | endif |
| 210 | if config_gfxnvidia |
| 211 | srcs += 'gfxnvidia.c' |
| 212 | cargs += '-DCONFIG_GFXNVIDIA=1' |
| 213 | endif |
| 214 | if config_internal |
| 215 | srcs += 'board_enable.c' |
| 216 | srcs += 'cbtable.c' |
| 217 | srcs += 'chipset_enable.c' |
| 218 | srcs += 'internal.c' |
| 219 | srcs += 'processor_enable.c' |
| 220 | if target_machine.cpu_family() == 'x86' or target_machine.cpu_family() == 'x86_64' |
| 221 | srcs += 'amd_imc.c' |
| 222 | srcs += 'dmi.c' |
| 223 | srcs += 'ichspi.c' |
Richard Hughes | cb97368 | 2018-12-19 11:44:22 +0000 | [diff] [blame] | 224 | srcs += 'it87spi.c' |
| 225 | srcs += 'mcp6x_spi.c' |
| 226 | srcs += 'sb600spi.c' |
| 227 | srcs += 'wbsio_spi.c' |
| 228 | endif |
| 229 | config_bitbang_spi = true |
| 230 | cargs += '-DCONFIG_INTERNAL=1' |
| 231 | if get_option('config_internal_dmi') |
| 232 | # Use internal DMI/SMBIOS decoder by default instead of relying on dmidecode. |
| 233 | cargs += '-DCONFIG_INTERNAL_DMI=1' |
| 234 | endif |
| 235 | endif |
| 236 | if config_it8212 |
| 237 | srcs += 'it8212.c' |
| 238 | cargs += '-DCONFIG_IT8212=1' |
| 239 | endif |
Marc Schink | 7ec2d63 | 2020-12-08 22:20:50 +0100 | [diff] [blame] | 240 | if config_jlink_spi |
| 241 | srcs += 'jlink_spi.c' |
| 242 | cargs += '-DCONFIG_JLINK_SPI=1' |
| 243 | deps += dependency('libjaylink') |
| 244 | endif |
Richard Hughes | cb97368 | 2018-12-19 11:44:22 +0000 | [diff] [blame] | 245 | if config_linux_mtd |
| 246 | srcs += 'linux_mtd.c' |
| 247 | cargs += '-DCONFIG_LINUX_MTD=1' |
| 248 | endif |
| 249 | if config_linux_spi |
| 250 | srcs += 'linux_spi.c' |
| 251 | cargs += '-DCONFIG_LINUX_SPI=1' |
| 252 | endif |
| 253 | if config_mstarddc_spi |
| 254 | srcs += 'mstarddc_spi.c' |
| 255 | cargs += '-DCONFIG_MSTARDDC_SPI=1' |
| 256 | endif |
| 257 | if config_nic3com |
| 258 | srcs += 'nic3com.c' |
| 259 | cargs += '-DCONFIG_NIC3COM=1' |
| 260 | endif |
| 261 | if config_nicintel |
| 262 | srcs += 'nicintel.c' |
| 263 | cargs += '-DCONFIG_NICINTEL=1' |
| 264 | endif |
| 265 | if config_nicintel_eeprom |
| 266 | srcs += 'nicintel_eeprom.c' |
| 267 | cargs += '-DCONFIG_NICINTEL_EEPROM=1' |
| 268 | endif |
| 269 | if config_nicintel_spi |
| 270 | srcs += 'nicintel_spi.c' |
| 271 | config_bitbang_spi = true |
| 272 | cargs += '-DCONFIG_NICINTEL_SPI=1' |
| 273 | endif |
| 274 | if config_nicnatsemi |
| 275 | srcs += 'nicnatsemi.c' |
| 276 | cargs += '-DCONFIG_NICNATSEMI=1' |
| 277 | endif |
| 278 | if config_nicrealtek |
| 279 | srcs += 'nicrealtek.c' |
| 280 | cargs += '-DCONFIG_NICREALTEK=1' |
| 281 | endif |
| 282 | if config_ogp_spi |
| 283 | config_bitbang_spi = true |
| 284 | srcs += 'ogp_spi.c' |
| 285 | cargs += '-DCONFIG_OGP_SPI=1' |
| 286 | endif |
| 287 | if config_pickit2_spi |
| 288 | srcs += 'pickit2_spi.c' |
| 289 | cargs += '-DCONFIG_PICKIT2_SPI=1' |
Richard Hughes | cb97368 | 2018-12-19 11:44:22 +0000 | [diff] [blame] | 290 | endif |
| 291 | if config_pony_spi |
| 292 | srcs += 'pony_spi.c' |
| 293 | need_serial = true |
| 294 | config_bitbang_spi = true |
| 295 | cargs += '-DCONFIG_PONY_SPI=1' |
| 296 | endif |
| 297 | if config_rayer_spi |
| 298 | srcs += 'rayer_spi.c' |
| 299 | config_bitbang_spi = true |
| 300 | need_raw_access = true |
| 301 | cargs += '-DCONFIG_RAYER_SPI=1' |
| 302 | endif |
| 303 | if config_satamv |
| 304 | srcs += 'satamv.c' |
| 305 | cargs += '-DCONFIG_SATAMV=1' |
| 306 | endif |
| 307 | if config_satasii |
| 308 | srcs += 'satasii.c' |
| 309 | cargs += '-DCONFIG_SATASII=1' |
| 310 | endif |
| 311 | if config_serprog |
| 312 | srcs += 'serprog.c' |
| 313 | cargs += '-DCONFIG_SERPROG=1' |
| 314 | need_serial = true |
| 315 | endif |
| 316 | if config_usbblaster_spi |
| 317 | srcs += 'usbblaster_spi.c' |
| 318 | cargs += '-DCONFIG_USBBLASTER_SPI=1' |
| 319 | endif |
Miklós Márton | 324929c | 2019-08-01 19:14:10 +0200 | [diff] [blame] | 320 | if config_stlinkv3_spi |
| 321 | srcs += 'stlinkv3_spi.c' |
| 322 | cargs += '-DCONFIG_STLINKV3_SPI=1' |
| 323 | endif |
Richard Hughes | cb97368 | 2018-12-19 11:44:22 +0000 | [diff] [blame] | 324 | |
| 325 | # bitbanging SPI infrastructure |
| 326 | if config_bitbang_spi |
| 327 | srcs += 'bitbang_spi.c' |
| 328 | cargs += '-DCONFIG_BITBANG_SPI=1' |
| 329 | endif |
| 330 | |
| 331 | # raw memory, MSR or PCI port I/O access |
| 332 | if need_raw_access |
| 333 | srcs += 'hwaccess.c' |
Thomas Heijligen | a065520 | 2021-12-14 16:36:05 +0100 | [diff] [blame] | 334 | srcs += 'hwaccess_x86_io.c' |
Thomas Heijligen | b3287b4 | 2021-12-14 17:25:49 +0100 | [diff] [blame^] | 335 | srcs += 'hwaccess_x86_msr.c' |
Richard Hughes | cb97368 | 2018-12-19 11:44:22 +0000 | [diff] [blame] | 336 | srcs += 'physmap.c' |
| 337 | cargs += '-DNEED_RAW_ACCESS=1' |
Thomas Heijligen | a065520 | 2021-12-14 16:36:05 +0100 | [diff] [blame] | 338 | cargs += '-D__FLASHROM_HAVE_OUTB__=1' |
Richard Hughes | cb97368 | 2018-12-19 11:44:22 +0000 | [diff] [blame] | 339 | endif |
| 340 | |
| 341 | # raw serial IO |
| 342 | if need_serial |
Richard Hughes | cb97368 | 2018-12-19 11:44:22 +0000 | [diff] [blame] | 343 | srcs += 'serial.c' |
Thomas Heijligen | 140c126 | 2021-09-27 15:12:26 +0200 | [diff] [blame] | 344 | if host_machine.system() == 'linux' |
| 345 | srcs += 'custom_baud_linux.c' |
| 346 | else |
| 347 | srcs += 'custom_baud.c' |
| 348 | endif |
Richard Hughes | cb97368 | 2018-12-19 11:44:22 +0000 | [diff] [blame] | 349 | endif |
| 350 | |
Richard Hughes | cb97368 | 2018-12-19 11:44:22 +0000 | [diff] [blame] | 351 | prefix = get_option('prefix') |
| 352 | sbindir = join_paths(prefix, get_option('sbindir')) |
| 353 | libdir = join_paths(prefix, get_option('libdir')) |
Richard Hughes | dad3a16 | 2020-02-17 09:57:01 +0000 | [diff] [blame] | 354 | mandir = join_paths(prefix, get_option('mandir')) |
Richard Hughes | cb97368 | 2018-12-19 11:44:22 +0000 | [diff] [blame] | 355 | |
| 356 | install_headers([ |
| 357 | 'libflashrom.h', |
| 358 | ], |
| 359 | ) |
| 360 | |
| 361 | # core modules needed by both the library and the CLI |
| 362 | srcs += '82802ab.c' |
| 363 | srcs += 'at45db.c' |
| 364 | srcs += 'edi.c' |
| 365 | srcs += 'en29lv640b.c' |
| 366 | srcs += 'flashchips.c' |
| 367 | srcs += 'flashrom.c' |
| 368 | srcs += 'fmap.c' |
| 369 | srcs += 'helpers.c' |
| 370 | srcs += 'ich_descriptors.c' |
| 371 | srcs += 'jedec.c' |
| 372 | srcs += 'layout.c' |
| 373 | srcs += 'libflashrom.c' |
| 374 | srcs += 'opaque.c' |
| 375 | srcs += 'print.c' |
| 376 | srcs += 'programmer.c' |
Thomas Heijligen | bbfacff | 2021-03-31 20:40:01 +0200 | [diff] [blame] | 377 | srcs += 'programmer_table.c' |
Richard Hughes | cb97368 | 2018-12-19 11:44:22 +0000 | [diff] [blame] | 378 | srcs += 'sfdp.c' |
| 379 | srcs += 'spi25.c' |
| 380 | srcs += 'spi25_statusreg.c' |
David Hendricks | 349b5d2 | 2019-10-05 12:44:27 -0700 | [diff] [blame] | 381 | srcs += 'spi95.c' |
Richard Hughes | cb97368 | 2018-12-19 11:44:22 +0000 | [diff] [blame] | 382 | srcs += 'spi.c' |
| 383 | srcs += 'sst28sf040.c' |
| 384 | srcs += 'sst49lfxxxc.c' |
| 385 | srcs += 'sst_fwhub.c' |
| 386 | srcs += 'stm50.c' |
| 387 | srcs += 'udelay.c' |
| 388 | srcs += 'w29ee011.c' |
| 389 | srcs += 'w39.c' |
Nikolai Artemiev | da1c834 | 2021-10-21 00:58:12 +1100 | [diff] [blame] | 390 | srcs += 'writeprotect.c' |
Nikolai Artemiev | c9feb1b | 2021-10-21 01:35:13 +1100 | [diff] [blame] | 391 | srcs += 'writeprotect_ranges.c' |
Richard Hughes | cb97368 | 2018-12-19 11:44:22 +0000 | [diff] [blame] | 392 | |
| 393 | mapfile = 'libflashrom.map' |
| 394 | vflag = '-Wl,--version-script,@0@/@1@'.format(meson.current_source_dir(), mapfile) |
Daniel Campello | 4bcc9a3 | 2021-03-17 18:03:28 -0600 | [diff] [blame] | 395 | flashrom = library( |
Richard Hughes | cb97368 | 2018-12-19 11:44:22 +0000 | [diff] [blame] | 396 | 'flashrom', |
| 397 | sources : [ |
| 398 | srcs, |
| 399 | ], |
| 400 | soversion : lt_current, |
| 401 | version : lt_version, |
| 402 | dependencies : [ |
| 403 | deps, |
| 404 | ], |
| 405 | c_args : [ |
| 406 | cargs, |
| 407 | ], |
| 408 | install : true, |
| 409 | link_args : vflag, |
| 410 | link_depends : mapfile, |
| 411 | ) |
| 412 | |
Mario Limonciello | d954d5d | 2019-09-24 16:06:57 -0500 | [diff] [blame] | 413 | version = meson.project_version() |
| 414 | #strip leading characters |
| 415 | if version.startswith('v') |
| 416 | version = version.split('v')[1] |
| 417 | endif |
| 418 | if version.startswith('p') |
| 419 | version = version.split('p')[1] |
| 420 | endif |
| 421 | |
Richard Hughes | cb97368 | 2018-12-19 11:44:22 +0000 | [diff] [blame] | 422 | pkgg = import('pkgconfig') |
| 423 | pkgg.generate( |
| 424 | libraries : flashrom, |
Mario Limonciello | d954d5d | 2019-09-24 16:06:57 -0500 | [diff] [blame] | 425 | version : version, |
Mario Limonciello | 2a8d439 | 2019-10-15 13:32:19 -0500 | [diff] [blame] | 426 | name : 'flashrom', |
| 427 | filebase : 'flashrom', |
| 428 | description : 'library to interact with flashrom', |
Richard Hughes | cb97368 | 2018-12-19 11:44:22 +0000 | [diff] [blame] | 429 | ) |
| 430 | |
Richard Hughes | dad3a16 | 2020-02-17 09:57:01 +0000 | [diff] [blame] | 431 | conf.set('VERSION', version) |
Samuel R. Messner | 21bcfa9 | 2022-02-17 06:17:31 +0100 | [diff] [blame] | 432 | conf.set('MAN_DATE', run_command('util/getversion.sh', '--man-date').stdout().strip()) |
Richard Hughes | dad3a16 | 2020-02-17 09:57:01 +0000 | [diff] [blame] | 433 | configure_file( |
| 434 | input : 'flashrom.8.tmpl', |
| 435 | output : 'flashrom.8', |
| 436 | configuration : conf, |
| 437 | install: true, |
| 438 | install_dir: join_paths(mandir, 'man8'), |
| 439 | ) |
| 440 | |
Richard Hughes | cb97368 | 2018-12-19 11:44:22 +0000 | [diff] [blame] | 441 | flashrom_dep = declare_dependency( |
| 442 | link_with : flashrom, |
| 443 | include_directories : include_directories('.'), |
| 444 | dependencies : deps |
| 445 | ) |
| 446 | |
Thomas Heijligen | 84e9c91 | 2021-06-01 16:22:14 +0200 | [diff] [blame] | 447 | if config_default_programmer_name != '' |
| 448 | cargs += '-DCONFIG_DEFAULT_PROGRAMMER_NAME=&programmer_' + config_default_programmer_name |
| 449 | else |
| 450 | cargs += '-DCONFIG_DEFAULT_PROGRAMMER_NAME=NULL' |
| 451 | endif |
| 452 | |
| 453 | cargs += '-DCONFIG_DEFAULT_PROGRAMMER_ARGS="' + config_default_programmer_args + '"' |
| 454 | |
Daniel Campello | f7a84fd | 2021-03-16 17:17:14 -0600 | [diff] [blame] | 455 | if config_print_wiki |
| 456 | srcs += 'print_wiki.c' |
| 457 | cargs += '-DCONFIG_PRINT_WIKI=1' |
| 458 | endif |
| 459 | |
Richard Hughes | cb97368 | 2018-12-19 11:44:22 +0000 | [diff] [blame] | 460 | # we can't just link_with libflashrom as we require all the internal symbols... |
| 461 | executable( |
| 462 | 'flashrom', |
| 463 | sources : [ |
| 464 | srcs, |
| 465 | 'cli_classic.c', |
| 466 | 'cli_common.c', |
| 467 | 'cli_output.c', |
| 468 | 'flashrom.c', |
| 469 | ], |
| 470 | dependencies : [ |
| 471 | deps, |
| 472 | ], |
| 473 | c_args : [ |
| 474 | cargs, |
Richard Hughes | cb97368 | 2018-12-19 11:44:22 +0000 | [diff] [blame] | 475 | ], |
| 476 | install : true, |
| 477 | install_dir : sbindir, |
| 478 | ) |
| 479 | |
| 480 | subdir('util') |