From 423a10417bf27bccf25d0da05f65f100353dc9dd Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@pulkomandy.tk>
Date: Fri, 20 Sep 2019 14:50:08 +0200
Subject: Import changes from icu 60.1 patchset.


diff --git a/source/common/putilimp.h b/source/common/putilimp.h
index d9c90cf..23a76c4 100644
--- a/source/common/putilimp.h
+++ b/source/common/putilimp.h
@@ -101,7 +101,7 @@ typedef size_t uintptr_t;
 #if U_PLATFORM_HAS_WINUWP_API == 0
 #   define U_TZSET _tzset
 #endif
-#elif U_PLATFORM == U_PF_OS400
+#elif U_PLATFORM == U_PF_OS400 || defined(__HAIKU__)
    /* not defined */
 #else
 #   define U_TZSET tzset
@@ -139,7 +139,7 @@ typedef size_t uintptr_t;
 #if U_PLATFORM_HAS_WINUWP_API == 0
 #   define U_TZNAME _tzname
 #endif
-#elif U_PLATFORM == U_PF_OS400
+#elif U_PLATFORM == U_PF_OS400 || defined(__HAIKU__)
    /* not defined */
 #else
 #   define U_TZNAME tzname
diff --git a/source/configure.ac b/source/configure.ac
index 759c495..9ec77fd 100644
--- a/source/configure.ac
+++ b/source/configure.ac
@@ -311,7 +311,7 @@ if test "$ENABLE_STATIC" = "YES"; then
             OLD_LDFLAGS="${LDFLAGS}"
 
             case "${host}" in
-            *-linux*|i*86-*-*bsd*|i*86-pc-gnu)
+            *-linux*|i*86-*-*bsd*|i*86-pc-gnu|*-haiku*)
                 if test "$GCC" = yes; then
                     CPPFLAGS="${CPPFLAGS} -ffunction-sections -fdata-sections"
                     LDFLAGS="${LDFLAGS} -Wl,--gc-sections"
@@ -808,50 +808,12 @@ else
 fi
 AC_SUBST(U_HAVE_POPEN)
 
-AC_CHECK_FUNC(tzset)
+#AC_CHECK_FUNC(tzset)
 U_HAVE_TZSET=0
-if test x$ac_cv_func_tzset = xyes
-then
-    U_TZSET=tzset
-    U_HAVE_TZSET=1
-else
-    AC_CHECK_FUNC(_tzset)
-    if test x$ac_cv_func__tzset = xyes
-    then
-        U_TZSET=_tzset
-        U_HAVE_TZSET=1
-    else
-      CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_HAVE_TZSET=0"
-    fi
-fi
 AC_SUBST(U_HAVE_TZSET)
 AC_SUBST(U_TZSET)
 
 U_HAVE_TZNAME=0
-AC_CACHE_CHECK(for tzname,ac_cv_var_tzname,
-[AC_LINK_IFELSE([AC_LANG_PROGRAM([[#ifndef _XOPEN_SOURCE
-#define _XOPEN_SOURCE
-#endif
-#include <stdlib.h>
-#include <time.h>
-#ifndef tzname /* For SGI.  */
-extern char *tzname[]; /* RS6000 and others reject char **tzname.  */
-#endif]], [atoi(*tzname);])],[ac_cv_var_tzname=yes],[ac_cv_var_tzname=no])])
-if test $ac_cv_var_tzname = yes; then
-  U_TZNAME=tzname
-  U_HAVE_TZNAME=1
-else
-  AC_CACHE_CHECK(for _tzname,ac_cv_var__tzname,
-  [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdlib.h>
-  #include <time.h>
-  extern char *_tzname[];]], [atoi(*_tzname);])],[ac_cv_var__tzname=yes],[ac_cv_var__tzname=no])])
-    if test $ac_cv_var__tzname = yes; then
-      U_TZNAME=_tzname
-      U_HAVE_TZNAME=1
-    else
-     CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_HAVE_TZNAME=0"
-    fi
-fi
 AC_SUBST(U_HAVE_TZNAME)
 AC_SUBST(U_TZNAME)
 
@@ -1296,6 +1258,7 @@ case "${host}" in
 	*-*-nto*)	platform=U_QNX ;;
 	*-dec-osf*) 	platform=U_OSF ;;
 	*-*-beos)		platform=U_BEOS ;;
+	*-*-haiku)		platform=U_HAIKU ;;
 	*-*-irix*)		platform=U_IRIX ;;
 	*-ncr-*)		platform=U_MPRAS ;;
 	*) 		platform=U_UNKNOWN_PLATFORM ;;
diff --git a/source/tools/tzcode/Makefile.in b/source/tools/tzcode/Makefile.in
index 80139f7..51328f1 100644
--- a/source/tools/tzcode/Makefile.in
+++ b/source/tools/tzcode/Makefile.in
@@ -139,7 +139,7 @@ $(ICUZDUMPTARG):	$(srcdir)/icuzdump.cpp
 		$(LINK.cc)  -I$(srcdir) -I$(top_srcdir)/common -I$(top_srcdir)/i18n -I$(top_srcdir)/tools/toolutil -I$(top_srcdir)/io  -pedantic $(srcdir)/icuzdump.cpp $(LIBICUUC) $(LIBICUDT) $(LIBICUI18N) $(LIBICUIO) $(LIBICUTOOLUTIL) -o $@
 
 
-$(TDATA): tdatamarker
+$(TDATA) $(XDATA): tdatamarker
 
 tdatamarker: $(TZDATA)
 	mkdir $(VANGUARD_DIR)
-- 
2.28.0


From 3aaeee6be5f2d7cb52de70120d2d36872532969f Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@pulkomandy.tk>
Date: Fri, 20 Sep 2019 16:03:07 +0200
Subject: Fix duplicate definition of constant

This may still be needed but only in the gcc2 version of the patch

diff --git a/source/config/mh-haiku b/source/config/mh-haiku
index bb814cd..965c949 100644
--- a/source/config/mh-haiku
+++ b/source/config/mh-haiku
@@ -20,7 +20,7 @@ LIBCPPFLAGS =
 THREADSCPPFLAGS =
 
 #
-CPPFLAGS += -D__STDC_ISO_10646__ -DU_CHARSET_IS_UTF8=1
+CPPFLAGS += -DU_CHARSET_IS_UTF8=1
 
 ## Compiler switch to embed a runtime search path
 LD_RPATH=
-- 
2.28.0


From 205d912c76585b5b6862e4e940fd1140b741e401 Mon Sep 17 00:00:00 2001
From: yumaoka <y.umaoka@gmail.com>
Date: Thu, 8 Oct 2020 20:52:39 -0400
Subject: ICU-21325 tz database 2020b updates


diff --git a/source/tools/tzcode/Makefile.in b/source/tools/tzcode/Makefile.in
index 51328f1..ea249f0 100644
--- a/source/tools/tzcode/Makefile.in
+++ b/source/tools/tzcode/Makefile.in
@@ -19,14 +19,11 @@ TZCODE = $(firstword $(wildcard ./tzcode*.tar.gz) $(wildcard $(srcdir)/tzcode*.t
 endif
 
 
-PRIMARY_YDATA=	africa antarctica asia australasia \
-		europe northamerica southamerica
-YDATA=		$(PRIMARY_YDATA) pacificnew etcetera factory backward
-NDATA=		systemv
-SDATA=		solar87 solar88 solar89
-#TDATA=		$(YDATA) $(NDATA) $(SDATA)
-TDATA=		$(YDATA) $(NDATA)
-YEARISTYPE=     ./yearistype
+PRIMARY_DATA = africa antarctica asia australasia europe northamerica southamerica
+SUPPLEMENTAL_DATA = etcetera factory backward
+#DEPRECATED_DATA = pacificnew systemv solar87 solar88 solar89
+#TDATA =	$(PRIMARY_DATA) $(SUPPLEMENTAL_DATA) $(DEPRECATED_DATA)
+TDATA =	$(PRIMARY_DATA) $(SUPPLEMENTAL_DATA)
 
 TZDIR=zoneinfo
 
@@ -34,7 +31,7 @@ CFLAGS+=-D_POSIX_C_SOURCE
 CPPFLAGS+= -DTZDIR=\"$(TZDIR)\" 
 
 # more data
-XDATA=zone.tab yearistype.sh leapseconds iso3166.tab
+XDATA=zone.tab leapseconds iso3166.tab
 ICUDATA=ZoneMetaData.java icu_zone.txt tz2icu zoneinfo64.txt zoneinfo.txt
 
 VANGUARD_DIR= ./vanguard
@@ -102,8 +99,8 @@ tzorig:	$(TZCODE) $(TZDATA)
 	cat $(TZORIG)/factory.orig $(srcdir)/icuzones > $(TZORIG)/factory
 	-mv $(TZORIG)/zishrink.awk $(TZORIG)/zishrink.awk.orig
 	sed -e '/if (line ~ \/^R SystemV \/) return/s/^/#/' $(TZORIG)/zishrink.awk.orig > $(TZORIG)/zishrink.awk
-	-mv $(TZORIG)/Makefile $(TZORIG)/Makefile.orig
-	sed -e "s/^BACKWARD=.*/BACKWARD= backward pacificnew/" $(TZORIG)/Makefile.orig > $(TZORIG)/Makefile
+#	-mv $(TZORIG)/Makefile $(TZORIG)/Makefile.orig
+#	sed -e "s/^BACKWARD=.*/BACKWARD= backward pacificnew/" $(TZORIG)/Makefile.orig > $(TZORIG)/Makefile
 	$(MAKE) -C $@ $(TZORIG_OPTS) zdump zones
 
 $(ZDUMPOUT): tzorig
@@ -129,7 +126,7 @@ $(ICUZDUMPOUT): $(ICUZDUMPEXEC)
 #
 
 
-$(ZICTARG):		$(OBJECTS) $(TDATA) yearistype $(srcdir)/tz2icu.h
+$(ZICTARG):		$(OBJECTS) $(TDATA) $(srcdir)/tz2icu.h
 		$(CC) $(CFLAGS) $(TZORIG_EXTRA_CFLAGS) $(LFLAGS) -I$(srcdir) $(OBJECTS) $(LDLIBS) -o $@
 
 $(TZ2ICUTARG):	$(srcdir)/tz2icu.cpp $(srcdir)/tz2icu.h
@@ -150,12 +147,8 @@ tdatamarker: $(TZDATA)
 	done
 	touch $@
 
-yearistype:	yearistype.sh
-		cp yearistype.sh yearistype
-		chmod +x yearistype
-
 posix_only:	$(ZICEXEC) $(TDATA) $(srcdir)/icuzones
-		$(ZICEXEC) -y $(YEARISTYPE) -d $(TZDIR) -L /dev/null $(TDATA) $(srcdir)/icuzones
+		$(ZICEXEC) -d $(TZDIR) -L /dev/null $(TDATA) $(srcdir)/icuzones
 
 
 icu_data:	$(TZ2ICUEXEC) posix_only
@@ -163,7 +156,7 @@ icu_data:	$(TZ2ICUEXEC) posix_only
 		$(TZ2ICUEXEC) $(TZDIR) zone.tab `echo $(TZDATA) | sed -e "s/.*\/tzdata//;s/\.tar\.gz$$//"` --old
 
 clean:
-		-rm -f core *.o *.out zdump${EXEEXT} $(ZICTARG) yearistype date $(TZ2ICUTARG)
+		-rm -f core *.o *.out zdump${EXEEXT} $(ZICTARG) date $(TZ2ICUTARG)
 		@echo ICU specific cleanup:
 		-rm -f $(ICUDATA)
 		-rm -rf $(TZDIR)
diff --git a/source/tools/tzcode/icuzdump.cpp b/source/tools/tzcode/icuzdump.cpp
index 71551ed..783f63d 100644
--- a/source/tools/tzcode/icuzdump.cpp
+++ b/source/tools/tzcode/icuzdump.cpp
@@ -137,12 +137,12 @@ public:
 
         getCutOverTimes(cutlo, cuthi);
         t = cutlo;
-        timezone->getOffset(t, FALSE, rawOffset, dstOffset, status);
+        timezone->getOffset(t, false, rawOffset, dstOffset, status);
         while (t < cuthi) {
             int32_t newRawOffset, newDstOffset;
             UDate newt = t + SEARCH_INCREMENT;
 
-            timezone->getOffset(newt, FALSE, newRawOffset, newDstOffset, status);
+            timezone->getOffset(newt, false, newRawOffset, newDstOffset, status);
 
             UBool bSameOffset = (rawOffset + dstOffset) == (newRawOffset + newDstOffset);
             UBool bSameDst = ((dstOffset != 0) && (newDstOffset != 0)) || ((dstOffset == 0) && (newDstOffset == 0));
@@ -158,7 +158,7 @@ public:
                     }
                     UDate medt = lot + ((diff / 2) / tick) * tick;
                     int32_t medRawOffset, medDstOffset;
-                    timezone->getOffset(medt, FALSE, medRawOffset, medDstOffset, status);
+                    timezone->getOffset(medt, false, medRawOffset, medDstOffset, status);
 
                     bSameOffset = (rawOffset + dstOffset) == (medRawOffset + medDstOffset);
                     bSameDst = ((dstOffset != 0) && (medDstOffset != 0)) || ((dstOffset == 0) && (medDstOffset == 0));
@@ -171,10 +171,10 @@ public:
                 }
                 // write out the boundary
                 str.remove();
-                formatter->format(lot, rawOffset + dstOffset, (dstOffset == 0 ? FALSE : TRUE), str);
+                formatter->format(lot, rawOffset + dstOffset, (dstOffset == 0 ? false : true), str);
                 out << str << " > ";
                 str.remove();
-                formatter->format(hit, newRawOffset + newDstOffset, (newDstOffset == 0 ? FALSE : TRUE), str);
+                formatter->format(hit, newRawOffset + newDstOffset, (newDstOffset == 0 ? false : true), str);
                 out << str;
                 if (linesep != NULL) {
                     out << linesep;
@@ -211,7 +211,7 @@ private:
 
 class ZoneIterator {
 public:
-    ZoneIterator(UBool bAll = FALSE) {
+    ZoneIterator(UBool bAll = false) {
         if (bAll) {
             zenum = TimeZone::createEnumeration();
         }
@@ -288,7 +288,7 @@ extern int
 main(int argc, char *argv[]) {
     int32_t low = 1902;
     int32_t high = 2038;
-    UBool bAll = FALSE;
+    UBool bAll = false;
     const char *dir = NULL;
     const char *linesep = NULL;
 
@@ -355,7 +355,7 @@ main(int argc, char *argv[]) {
 
     ZoneIterator* zit;
     if (bAll) {
-        zit = new ZoneIterator(TRUE);
+        zit = new ZoneIterator(true);
     } else {
         if (argc <= 1) {
             zit = new ZoneIterator();
@@ -402,7 +402,7 @@ main(int argc, char *argv[]) {
 
     } else {
         // stdout
-        UBool bFirst = TRUE;
+        UBool bFirst = true;
         for (;;) {
             TimeZone* tz = zit->next();
             if (tz == NULL) {
@@ -411,7 +411,7 @@ main(int argc, char *argv[]) {
             dumper.setTimeZone(tz);
             tz->getID(id);
             if (bFirst) {
-                bFirst = FALSE;
+                bFirst = false;
             } else {
                 cout << endl;
             }
diff --git a/source/tools/tzcode/icuzones b/source/tools/tzcode/icuzones
index 77cf719..52f5698 100644
--- a/source/tools/tzcode/icuzones
+++ b/source/tools/tzcode/icuzones
@@ -17,7 +17,19 @@
 Zone	Etc/Unknown	0	-	Unknown
 
 # SystemV time zones.
-# The Olson systemv file has these commented out.
+# IANA tzdb file 'systemv' file has these SystemV/* zones commented out up to 2020a.
+# 'systemv' file was removed in 2020b. We keep them in this supplemental zone data
+# file for compatibility purpose.
+
+# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
+Rule	SystemV	min	1973	-	Apr	lastSun	2:00	1:00	D
+Rule	SystemV	min	1973	-	Oct	lastSun	2:00	0	S
+Rule	SystemV	1974	only	-	Jan	6	2:00	1:00	D
+Rule	SystemV	1974	only	-	Nov	lastSun	2:00	0	S
+Rule	SystemV	1975	only	-	Feb	23	2:00	1:00	D
+Rule	SystemV	1975	only	-	Oct	lastSun	2:00	0	S
+Rule	SystemV	1976	max	-	Apr	lastSun	2:00	1:00	D
+Rule	SystemV	1976	max	-	Oct	lastSun	2:00	0	S
 
 # Zone	NAME		GMTOFF	RULES/SAVE	FORMAT	[UNTIL]
 Zone	SystemV/AST4ADT	-4:00	SystemV		A%sT
@@ -34,6 +46,11 @@ Zone	SystemV/PST8	-8:00	-		PST
 Zone	SystemV/YST9	-9:00	-		YST
 Zone	SystemV/HST10	-10:00	-		HST
 
+# pacificnew
+# IANA tzdb file 'pacificnew' used to contain a Link for US/Pacific-New.
+# 'pacificnew' file was removed in 2020b. We keep the Link here for compatibility.
+Link America/Los_Angeles US/Pacific-New
+
 
 # The list below is for supporting legacy ICU zone aliases.
 # These definitions were originally defined in tz.alias.
diff --git a/source/tools/tzcode/tz2icu.cpp b/source/tools/tzcode/tz2icu.cpp
index b946ffb..cf53c83 100644
--- a/source/tools/tzcode/tz2icu.cpp
+++ b/source/tools/tzcode/tz2icu.cpp
@@ -51,7 +51,7 @@
 
 using namespace std;
 
-bool ICU44PLUS = TRUE;
+bool ICU44PLUS = true;
 string TZ_RESOURCE_NAME = ICU_TZ_RESOURCE;
 
 //--------------------------------------------------------------------
@@ -1431,19 +1431,19 @@ void FinalRule::print(ostream& os) const {
 
 int main(int argc, char *argv[]) {
     string rootpath, zonetab, version;
-    bool validArgs = FALSE;
+    bool validArgs = false;
 
     if (argc == 4 || argc == 5) {
-        validArgs = TRUE;
+        validArgs = true;
         rootpath = argv[1];
         zonetab = argv[2];
         version = argv[3];
         if (argc == 5) {
             if (strcmp(argv[4], "--old") == 0) {
-                ICU44PLUS = FALSE;
+                ICU44PLUS = false;
                 TZ_RESOURCE_NAME = ICU_TZ_RESOURCE_OLD;
             } else {
-                validArgs = FALSE;
+                validArgs = false;
             }
         }
     }
@@ -1781,7 +1781,6 @@ int main(int argc, char *argv[]) {
     time_t sec;
     time(&sec);
     struct tm* now = localtime(&sec);
-    int32_t thisYear = now->tm_year + 1900;
 
     string filename = TZ_RESOURCE_NAME + ".txt";
     // Write out a resource-bundle source file containing data for
-- 
2.28.0

