# locale sources
.PATH: ${.CURDIR}/${MACHINE_ARCH}/locale ${.CURDIR}/locale
+CWD := ${.CURDIR}/locale
+.ifdef FEATURE_LEGACY_RUNE_APIS
# depreciated interfaces
MISRCS += frune.c mbrune.c runedepreciated.c setinvalidrune.c
+.for _src in frune.c mbrune.c setinvalidrune.c
+CFLAGS-${_src} += -D__FBSDID=__RCSID
+.endfor
+.endif
+
# extended locale
MISRCS += isctype.c iswctype.c xlocale.c
.include "Makefile.fbsd_begin"
-FBSDMISRCS= big5.c btowc.c collate.c collcmp.c euc.c fix_grouping.c \
+FBSDMISRCS= ascii.c big5.c btowc.c collate.c collcmp.c euc.c fix_grouping.c \
gb18030.c gb2312.c gbk.c \
ldpart.c lmessages.c lmonetary.c lnumeric.c localeconv.c \
mblen.c mbrlen.c mbrtowc.c mbsinit.c mbsnrtowcs.c mbsrtowcs.c \
mblocal.h setlocale.h
.include "Makefile.fbsd_end"
-# special case: utf2-fbsd.c is derived from utf8.c with utf2.c.patch
.ifmake autopatch
-AUTOPATCHSRCS+= utf2-fbsd.c
-utf2-fbsd.c: FreeBSD/utf8.c
- cp ${.ALLSRC} ${.TARGET}
- patch ${.TARGET} ${.ALLSRC:S/utf8/utf2/}.patch;
+# special case: utf2-fbsd.c is derived from utf8.c with utf2.c.patch
+
+# This .for statement forces evaluation of ${CWD}
+.for _cwd in ${CWD}
+AUTOPATCHSRCS+= ${_cwd}/utf2-fbsd.c
+${_cwd}/utf2-fbsd.c: ${_cwd}/FreeBSD/utf8.c
+ ${CP} ${.ALLSRC} ${.TARGET}
+ ${PATCH} ${.TARGET} ${.ALLSRC:S/utf8/utf2/}.patch
+.endfor # _cwd
+
.else # !autopatch
MISRCS+= utf2.c
.endif # autopatch
# also build a 64-bit long double version (ppc only)
LDBLSRCS += wcstold.c
-# Begin hack for 3333969
-
+.ifdef FEATURE_PATCH_3333969
MISRCS += lconv.c
-CFLAGS-lconv.c += -D__APPLE_PR_3333969_HACK__
-
-# End hack for 3333969
+.endif # FEATURE_PATCH_3333969
LEGACYSRCS += wcsftime.c
+CFLAGS-collate-fbsd.c += -D_DARWIN_UNLIMITED_STREAMS
+CFLAGS-setrunelocale-fbsd.c += -D_DARWIN_UNLIMITED_STREAMS
+
# set the LIBC_ALIAS_* macros so we can decorate the symbol independent
# of other macro settings
CFLAGS-wcsftime-fbsd.c += -DLIBC_ALIAS_WCSFTIME -DLIBC_ALIAS_WCSFTIME_L
-# for LP64, we need to create rune32.h
-# the following is good enough for ppc, ppc64, i386 and x86_64
+# For LP64, we need to create rune32.h
+# This happens at installsrc time, not build time, so the compiler we need
+# is HOSTCC.
.ifmake autopatch
-_ARCH != arch
+
+# This .for statement forces evaluation of ${CWD}
+.for _cwd in ${CWD}
+# The following is good enough for ppc, ppc64, i386 and x86_64
+_ARCH != ${ARCH}
.if $(_ARCH) == x86_64
ARCH32 = i386
.else
ARCH32 = $(_ARCH:C/64$//)
.endif
-rune32.h: rune-fbsd.c
- ${CC} -arch ${ARCH32} -I${.CURDIR}/include -DRUNEOFF32 -o ${SRCROOT}/rune32 ${.ALLSRC}
- ${SRCROOT}/rune32 > ${.TARGET}
- rm -f ${SRCROOT}/rune32
-AUTOPATCHHDRS+= rune32.h
+${_cwd}/rune32.h: ${_cwd}/rune-fbsd.c
+ ${CP} ${.CURDIR}/include/runetype.h ${_cwd}
+ ${HOSTCC} -arch ${ARCH32} -D_LIBC_NO_FEATURE_VERIFICATION -DRUNEOFF32 -o ${_cwd}/rune32 ${.ALLSRC}
+ ${_cwd}/rune32 > ${.TARGET}
+ ${RM} ${_cwd}/rune32 ${_cwd}/runetype.h
+AUTOPATCHHDRS+= ${_cwd}/rune32.h
+.endfor # _cwd
+
.endif # autopatch
.if ${LIB} == "c"
MAN3+= ctype_l.3 isalnum_l.3 iswalnum_l.3 wcstod_l.3 wcstol_l.3
MAN3+= duplocale.3 freelocale.3 newlocale.3 \
querylocale.3 uselocale.3 xlocale.3
+.ifdef FEATURE_LEGACY_RUNE_APIS
# depreciated man pages
MAN3+= mbrune.3 rune.3
+.endif
MAN5+= utf2.5
.include "Makefile.fbsd_begin"
MLINKS+= mbrtowc.3 mbrtowc_l.3
+.ifdef FEATURE_LEGACY_RUNE_APIS
MLINKS+= mbrune.3 mbmb.3 \
mbrune.3 mbrrune.3
+.endif
MLINKS+= mbsinit.3 mbsinit_l.3
MLINKS+= nl_langinfo.3 nl_langinfo_l.3
+.ifdef FEATURE_LEGACY_RUNE_APIS
MLINKS+= rune.3 fgetrune.3 \
rune.3 fputrune.3 \
rune.3 fungetrune.3 \
rune.3 setrunelocale.3 \
rune.3 sgetrune.3 \
rune.3 sputrune.3
+.endif
MLINKS+= tolower.3 tolower_l.3