security/nss/coreconf/Linux.mk

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 #
     2 # This Source Code Form is subject to the terms of the Mozilla Public
     3 # License, v. 2.0. If a copy of the MPL was not distributed with this
     4 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
     6 include $(CORE_DEPTH)/coreconf/UNIX.mk
     8 #
     9 # The default implementation strategy for Linux is now pthreads
    10 #
    11 ifneq ($(OS_TARGET),Android)
    12 	USE_PTHREADS = 1
    13 endif
    15 ifeq ($(USE_PTHREADS),1)
    16 	IMPL_STRATEGY = _PTH
    17 endif
    19 CC			= gcc
    20 CCC			= g++
    21 RANLIB			= ranlib
    23 DEFAULT_COMPILER = gcc
    25 ifeq ($(OS_TARGET),Android)
    26 ifndef ANDROID_NDK
    27 	$(error Must set ANDROID_NDK to the path to the android NDK first)
    28 endif
    29 	ANDROID_PREFIX=$(OS_TEST)-linux-androideabi
    30 	ANDROID_TARGET=$(ANDROID_PREFIX)-4.4.3
    31 	# should autodetect which linux we are on, currently android only
    32 	# supports linux-x86 prebuilts
    33 	ANDROID_TOOLCHAIN=$(ANDROID_NDK)/toolchains/$(ANDROID_TARGET)/prebuilt/linux-x86
    34 	ANDROID_SYSROOT=$(ANDROID_NDK)/platforms/android-$(OS_TARGET_RELEASE)/arch-$(OS_TEST)
    35 	ANDROID_CC=$(ANDROID_TOOLCHAIN)/bin/$(ANDROID_PREFIX)-gcc
    36 # internal tools need to be built with the native compiler
    37 ifndef INTERNAL_TOOLS
    38 	CC = $(ANDROID_CC) --sysroot=$(ANDROID_SYSROOT)
    39 	DEFAULT_COMPILER=$(ANDROID_PREFIX)-gcc
    40 	ARCHFLAG = --sysroot=$(ANDROID_SYSROOT)
    41 	DEFINES += -DNO_SYSINFO -DNO_FORK_CHECK -DANDROID
    42 	CROSS_COMPILE = 1
    43 endif
    44 endif
    45 ifeq ($(OS_TEST),ppc64)
    46 	CPU_ARCH	= ppc
    47 ifeq ($(USE_64),1)
    48 	ARCHFLAG	= -m64
    49 endif
    50 else
    51 ifeq ($(OS_TEST),alpha)
    52         OS_REL_CFLAGS   = -D_ALPHA_
    53 	CPU_ARCH	= alpha
    54 else
    55 ifeq ($(OS_TEST),x86_64)
    56 ifeq ($(USE_64),1)
    57 	CPU_ARCH	= x86_64
    58 	ARCHFLAG	= -m64
    59 else
    60 ifeq ($(USE_X32),1)
    61 	CPU_ARCH	= x86_64
    62 	ARCHFLAG	= -mx32
    63 	64BIT_TAG	= _x32
    64 else
    65 	OS_REL_CFLAGS	= -Di386
    66 	CPU_ARCH	= x86
    67 	ARCHFLAG	= -m32
    68 endif
    69 endif
    70 else
    71 ifeq ($(OS_TEST),sparc64)
    72 	CPU_ARCH        = sparc
    73 else
    74 ifeq (,$(filter-out arm% sa110,$(OS_TEST)))
    75 	CPU_ARCH        = arm
    76 else
    77 ifeq (,$(filter-out parisc%,$(OS_TEST)))
    78 	CPU_ARCH        = hppa
    79 else
    80 ifeq (,$(filter-out i%86,$(OS_TEST)))
    81 	OS_REL_CFLAGS	= -Di386
    82 	CPU_ARCH	= x86
    83 else
    84 ifeq ($(OS_TEST),sh4a)
    85 	CPU_ARCH        = sh4
    86 else
    87 # $(OS_TEST) == m68k, ppc, ia64, sparc, s390, s390x, mips, sh3, sh4
    88 	CPU_ARCH	= $(OS_TEST)
    89 endif
    90 endif
    91 endif
    92 endif
    93 endif
    94 endif
    95 endif
    96 endif
    99 ifneq ($(OS_TARGET),Android)
   100 LIBC_TAG		= _glibc
   101 endif
   103 ifeq ($(OS_RELEASE),2.0)
   104 	OS_REL_CFLAGS	+= -DLINUX2_0
   105 	MKSHLIB		= $(CC) -shared -Wl,-soname -Wl,$(@:$(OBJDIR)/%.so=%.so) $(RPATH)
   106 	ifdef MAPFILE
   107 		MKSHLIB += -Wl,--version-script,$(MAPFILE)
   108 	endif
   109 	PROCESS_MAP_FILE = grep -v ';-' $< | \
   110          sed -e 's,;+,,' -e 's; DATA ;;' -e 's,;;,,' -e 's,;.*,;,' > $@
   111 endif
   113 ifdef BUILD_OPT
   114 ifeq (11,$(ALLOW_OPT_CODE_SIZE)$(OPT_CODE_SIZE))
   115 	OPTIMIZER = -Os
   116 else
   117 	OPTIMIZER = -O2
   118 endif
   119 ifdef MOZ_DEBUG_SYMBOLS
   120 	ifdef MOZ_DEBUG_FLAGS
   121 		OPTIMIZER += $(MOZ_DEBUG_FLAGS)
   122 	else
   123 		OPTIMIZER += -gdwarf-2
   124 	endif
   125 endif
   126 endif
   129 ifeq ($(USE_PTHREADS),1)
   130 OS_PTHREAD = -lpthread 
   131 endif
   133 OS_CFLAGS		= $(DSO_CFLAGS) $(OS_REL_CFLAGS) $(ARCHFLAG) -Wall -Werror-implicit-function-declaration -Wno-switch -pipe -ffunction-sections -fdata-sections -DLINUX -Dlinux -DHAVE_STRERROR
   134 OS_LIBS			= $(OS_PTHREAD) -ldl -lc
   136 ifdef USE_PTHREADS
   137 	DEFINES		+= -D_REENTRANT
   138 endif
   140 ARCH			= linux
   142 DSO_CFLAGS		= -fPIC
   143 DSO_LDOPTS		= -shared $(ARCHFLAG) -Wl,--gc-sections
   144 # The linker on Red Hat Linux 7.2 and RHEL 2.1 (GNU ld version 2.11.90.0.8)
   145 # incorrectly reports undefined references in the libraries we link with, so
   146 # we don't use -z defs there.
   147 ZDEFS_FLAG		= -Wl,-z,defs
   148 DSO_LDOPTS		+= $(if $(findstring 2.11.90.0.8,$(shell ld -v)),,$(ZDEFS_FLAG))
   149 LDFLAGS			+= $(ARCHFLAG)
   151 # On Maemo, we need to use the -rpath-link flag for even the standard system
   152 # library directories.
   153 ifdef _SBOX_DIR
   154 LDFLAGS			+= -Wl,-rpath-link,/usr/lib:/lib
   155 endif
   157 # INCLUDES += -I/usr/include -Y/usr/include/linux
   158 G++INCLUDES		= -I/usr/include/g++
   160 #
   161 # Always set CPU_TAG on Linux.
   162 #
   163 CPU_TAG = _$(CPU_ARCH)
   165 #
   166 # On Linux 2.6 or later, build libfreebl3.so with no NSPR and libnssutil3.so
   167 # dependencies by default.  Set FREEBL_NO_DEPEND to 0 in the environment to
   168 # override this.
   169 #
   170 ifneq ($(OS_TARGET),Android)
   171 ifeq (2.6,$(firstword $(sort 2.6 $(OS_RELEASE))))
   172 ifndef FREEBL_NO_DEPEND
   173 FREEBL_NO_DEPEND = 1
   174 FREEBL_LOWHASH = 1
   175 endif
   176 endif
   177 endif
   179 USE_SYSTEM_ZLIB = 1
   180 ZLIB_LIBS = -lz
   182 # The -rpath '$$ORIGIN' linker option instructs this library to search for its
   183 # dependencies in the same directory where it resides.
   184 ifeq ($(BUILD_SUN_PKG), 1)
   185 ifeq ($(USE_64), 1)
   186 RPATH = -Wl,-rpath,'$$ORIGIN:/opt/sun/private/lib64:/opt/sun/private/lib'
   187 else
   188 RPATH = -Wl,-rpath,'$$ORIGIN:/opt/sun/private/lib'
   189 endif
   190 endif
   192 OS_REL_CFLAGS   += -DLINUX2_1
   193 MKSHLIB         = $(CC) $(DSO_LDOPTS) -Wl,-soname -Wl,$(@:$(OBJDIR)/%.so=%.so) $(RPATH)
   195 ifdef MAPFILE
   196 	MKSHLIB += -Wl,--version-script,$(MAPFILE)
   197 endif
   198 PROCESS_MAP_FILE = grep -v ';-' $< | \
   199         sed -e 's,;+,,' -e 's; DATA ;;' -e 's,;;,,' -e 's,;.*,;,' > $@
   201 ifeq ($(OS_RELEASE),2.4)
   202 DEFINES += -DNO_FORK_CHECK
   203 endif

mercurial