summaryrefslogtreecommitdiff
path: root/curl/curl/buildfile
blob: 7b88ae74f7ffa66280f23aa27918db5669746e12 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# file      : curl/buildfile
# license   : cURL License; see accompanying COPYING file

import libs  = libcurl%lib{curl}
import libs += libca-certificates-curl%lib{ca-certificates-curl}

exe{curl}: h{**} c{** -src/tool_main -lib/**} $libs

tclass = $c.target.class
tsys   = $c.target.system

# Build options.
#
c.poptions += -DHAVE_CONFIG_H

# Note that the upstream package uses the -pthread compiler/linker option on
# Linux and FreeBSD. The option is unsupported by build2 so we pass
# -D_REENTRANT and -lpthread preprocessor/linker options instead.
#
switch $tclass, $tsys
{
  case 'linux' | 'bsd'
    c.poptions += -D_REENTRANT

  case 'windows', 'win32-msvc'
    c.poptions += -DWIN32
}

c.poptions =+ "-I$src_base" "-I$src_base/src" "-I$src_base/lib"

switch $c.class, $tsys
{
  case 'gcc'
  {
    # Disable the Clang targeting MSVC warnings.
    #
    if ($c.id == 'clang' && $tsys == 'win32-msvc')
      c.coptions += -Wno-deprecated-declarations
  }
  case 'msvc'
  {
    # Disable warnings that pop up with /W3.
    #
    c.coptions += /wd4996
  }
}

switch $tclass, $tsys
{
  case 'linux' | 'bsd'
    c.libs += -lpthread

  case 'windows', 'mingw32'
    c.libs+= -lws2_32

  case 'windows'
    c.libs += ws2_32.lib
}