diff --git a/SOURCES/libical-1.0-avoid-putenv.patch b/SOURCES/libical-1.0-avoid-putenv.patch new file mode 100644 index 00000000..2b2fc808 --- /dev/null +++ b/SOURCES/libical-1.0-avoid-putenv.patch @@ -0,0 +1,177 @@ +diff -up libical-1.0.1/src/libical/icaltime.c.avoid-putenv libical-1.0.1/src/libical/icaltime.c +--- libical-1.0.1/src/libical/icaltime.c.avoid-putenv 2014-10-09 17:07:05.000000000 +0200 ++++ libical-1.0.1/src/libical/icaltime.c 2015-01-26 11:56:35.153309240 +0100 +@@ -64,11 +64,6 @@ + #define gmtime_r(tp,tmp) (gmtime(tp)?(*(tmp)=*gmtime(tp),(tmp)):0) + #endif + +-#ifdef HAVE_PTHREAD +- #include +- static pthread_mutex_t tzid_mutex = PTHREAD_MUTEX_INITIALIZER; +-#endif +- + /* + * Function to convert a struct tm time specification + * to an ANSI time_t using the specified time zone. +@@ -77,7 +72,7 @@ + * local daylight savings time applied to the result. + * This function expects well-formed input. + */ +-static time_t make_time(struct tm *tm, int tzm) ++static time_t make_time(struct tm *tm, int tzm, int be_strict) + { + time_t tim; + +@@ -91,13 +86,13 @@ static time_t make_time(struct tm *tm, i + #if (SIZEOF_TIME_T == 4) + /* check that year specification within range */ + +- if (tm->tm_year < 70 || tm->tm_year > 138) ++ if (be_strict && (tm->tm_year < 70 || tm->tm_year > 138)) + return((time_t) -1); + + /* check for upper bound of Jan 17, 2038 (to avoid possibility of + 32-bit arithmetic overflow) */ + +- if (tm->tm_year == 138) { ++ if (be_strict && tm->tm_year == 138) { + if (tm->tm_mon > 0) + return((time_t) -1); + else if (tm->tm_mday > 17) +@@ -291,99 +286,12 @@ time_t icaltime_as_timet(const struct ic + stm.tm_year = tt.year-1900; + stm.tm_isdst = -1; + +- t = make_time(&stm, 0); ++ t = make_time(&stm, 0, 1); + + return t; + + } + +- +-/* Structure used by set_tz to hold an old value of TZ, and the new +- value, which is in memory we will have to free in unset_tz */ +-/* This will hold the last "TZ=XXX" string we used with putenv(). After we +- call putenv() again to set a new TZ string, we can free the previous one. +- As far as I know, no libc implementations actually free the memory used in +- the environment variables (how could they know if it is a static string or +- a malloc'ed string?), so we have to free it ourselves. */ +-static char* saved_tz = NULL; +- +-/* If you use set_tz(), you must call unset_tz() some time later to restore the +- original TZ. Pass unset_tz() the string that set_tz() returns. Call both the functions +- locking the tzid mutex as in icaltime_as_timet_with_zone */ +-char* set_tz(const char* tzid) +-{ +- char *old_tz, *old_tz_copy = NULL, *new_tz; +- +- /* Get the old TZ setting and save a copy of it to return. */ +- old_tz = getenv("TZ"); +- if(old_tz){ +- old_tz_copy = (char*)malloc(strlen (old_tz) + 4); +- +- if(old_tz_copy == 0){ +- icalerror_set_errno(ICAL_NEWFAILED_ERROR); +- return 0; +- } +- +- strcpy (old_tz_copy, "TZ="); +- strcpy (old_tz_copy + 3, old_tz); +- } +- +- /* Create the new TZ string. */ +- new_tz = (char*)malloc(strlen (tzid) + 4); +- +- if(new_tz == 0){ +- icalerror_set_errno(ICAL_NEWFAILED_ERROR); +- free(old_tz_copy); +- return 0; +- } +- +- strcpy (new_tz, "TZ="); +- strcpy (new_tz + 3, tzid); +- +- /* Add the new TZ to the environment. */ +- putenv(new_tz); +- +- /* Free any previous TZ environment string we have used in a synchronized manner. */ +- +- free (saved_tz); +- +- /* Save a pointer to the TZ string we just set, so we can free it later. */ +- saved_tz = new_tz; +- +- return old_tz_copy; /* This will be zero if the TZ env var was not set */ +-} +- +-void unset_tz(char *tzstr) +-{ +- /* restore the original environment */ +- +- if(tzstr!=0){ +- putenv(tzstr); +- } else { +- /* Delete from environment. We prefer unsetenv(3) over putenv(3) +- because the former is POSIX and behaves consistently. The later +- does not unset the variable in some systems (like NetBSD), leaving +- it with an empty value. This causes problems later because further +- calls to time related functions in libc will treat times in UTC. */ +-#ifdef HAVE_UNSETENV +- unsetenv("TZ"); +-#else +-#ifdef _MSC_VER +- putenv("TZ="); // The equals is required to remove with MS Visual C++ +-#else +- putenv("TZ"); +-#endif +-#endif +- } +- +- /* Free any previous TZ environment string we have used in a synchronized manner */ +- free (saved_tz); +- +- /* Save a pointer to the TZ string we just set, so we can free it later. +- (This can possibly be NULL if there was no TZ to restore.) */ +- saved_tz = tzstr; +-} +- + /** Return the time as seconds past the UNIX epoch, using the + * given timezone. + * +@@ -397,8 +305,6 @@ time_t icaltime_as_timet_with_zone(const + { + icaltimezone *utc_zone; + struct tm stm; +- time_t t; +- char *old_tz; + struct icaltimetype local_tt; + + utc_zone = icaltimezone_get_utc_timezone (); +@@ -426,25 +332,8 @@ time_t icaltime_as_timet_with_zone(const + stm.tm_mon = local_tt.month-1; + stm.tm_year = local_tt.year-1900; + stm.tm_isdst = -1; +-/* The functions putenv and mktime are not thread safe, inserting a lock +-to prevent any crashes */ + +-#ifdef HAVE_PTHREAD +- pthread_mutex_lock (&tzid_mutex); +-#endif +- +- /* Set TZ to UTC and use mktime to convert to a time_t. */ +- old_tz = set_tz ("UTC"); +- tzset (); +- +- t = mktime (&stm); +- unset_tz (old_tz); +- tzset (); +- +-#ifdef HAVE_PTHREAD +- pthread_mutex_unlock (&tzid_mutex); +-#endif +- return t; ++ return make_time (&stm, 0, 0); + } + + const char* icaltime_as_ical_string(const struct icaltimetype tt) diff --git a/SOURCES/libical-3.0.3-cmake-version.patch b/SOURCES/libical-3.0.3-cmake-version.patch new file mode 100644 index 00000000..68b4b39f --- /dev/null +++ b/SOURCES/libical-3.0.3-cmake-version.patch @@ -0,0 +1,24 @@ +diff -up libical-3.0.3/CMakeLists.txt.cmake-version libical-3.0.3/CMakeLists.txt +--- libical-3.0.3/CMakeLists.txt.cmake-version 2018-02-27 16:34:25.000000000 +0100 ++++ libical-3.0.3/CMakeLists.txt 2018-05-31 16:31:14.858002781 +0200 +@@ -70,7 +70,7 @@ + # Build with the thread sanitizer (requires gcc or clang) + # + +-cmake_minimum_required(VERSION 3.1.0) #first line, to shutup a cygwin warning ++cmake_minimum_required(VERSION 2.8.0) #first line, to shutup a cygwin warning + project(libical C CXX) + + cmake_policy(SET CMP0003 NEW) +diff -up libical-3.0.3/cmake/modules/GObjectIntrospectionMacros.cmake.cmake-version libical-3.0.3/cmake/modules/GObjectIntrospectionMacros.cmake +--- libical-3.0.3/cmake/modules/GObjectIntrospectionMacros.cmake.cmake-version 2018-05-31 16:59:07.730979648 +0200 ++++ libical-3.0.3/cmake/modules/GObjectIntrospectionMacros.cmake 2018-05-31 17:03:01.110976420 +0200 +@@ -50,7 +50,7 @@ macro(gir_add_introspections introspecti + set(_gir_libtool "--no-libtool") + + add_custom_command( +- COMMAND ${CMAKE_COMMAND} -E env "CC='${CMAKE_C_COMPILER}'" ++ COMMAND + ${GObjectIntrospection_SCANNER} + ${GObjectIntrospection_SCANNER_ARGS} + --namespace=${_gir_namespace} diff --git a/SPECS/libical.spec b/SPECS/libical.spec new file mode 100644 index 00000000..e6d961e2 --- /dev/null +++ b/SPECS/libical.spec @@ -0,0 +1,319 @@ +%define compat_build_dir libical-1.0.1 + +Summary: Reference implementation of the iCalendar data type and serialization format +Name: libical +Version: 3.0.3 +Release: 2%{?dist} +License: LGPLv2 or MPLv2.0 +URL: https://libical.github.io/libical/ +Source: https://github.com/%{name}/%{name}/archive/v%{version}/%{name}-%{version}.tar.gz +Source1: https://github.com/%{name}/%{name}/archive/v1.0.1/%{name}-1.0.1.tar.gz +Patch0: libical-1.0-avoid-putenv.patch +Patch1: libical-3.0.3-cmake-version.patch + +# because 'Version:' in compat-libical subpackage overrides %%{version} value +%global gir_version %{version} + +BuildRequires: gcc +BuildRequires: gcc-c++ +BuildRequires: cmake +BuildRequires: gtk-doc +BuildRequires: pkgconfig(gobject-2.0) +BuildRequires: pkgconfig(gobject-introspection-1.0) +BuildRequires: pkgconfig(libxml-2.0) +BuildRequires: pkgconfig(icu-i18n) +BuildRequires: pkgconfig(icu-uc) +BuildRequires: perl +#BuildRequires: python +#BuildRequires: python-gobject +BuildRequires: vala +Requires: tzdata + +%description +Reference implementation of the iCalendar data type and serialization format +used in dozens of calendaring and scheduling products. + +%package devel +Summary: Development files for libical +Group: Development/Libraries +Requires: %{name}%{?_isa} = %{version}-%{release} +Requires: pkgconfig(icu-i18n) +Requires: pkgconfig(icu-uc) + +%description devel +The libical-devel package contains libraries and header files for developing +applications that use libical. + +%package glib +Summary: GObject wrapper for libical library +Provides: libical-glib%{?_isa} = %{version}-%{release} +Obsoletes: libical-glib < 3.0.0 +Requires: %{name}%{?_isa} = %{version}-%{release} + +%description glib +This package provides a GObject wrapper for libical library with support +of GObject Introspection. + +%package glib-doc +Summary: Documentation files for %{name}-glib +Group: Development/Libraries +Provides: libical-glib-doc = %{version}-%{release} +Obsoletes: libical-glib-doc < 3.0.0 +BuildArch: noarch + +%description glib-doc +This package contains developer documentation for %{name}-glib. + +%package glib-devel +Summary: Development files for building against %{name}-glib +Group: Development/Libraries +Provides: libical-glib-devel%{?_isa} = %{version}-%{release} +Obsoletes: libical-glib-devel < 3.0.0 +Requires: %{name}-devel%{?_isa} = %{version}-%{release} +Requires: %{name}-glib%{?_isa} = %{version}-%{release} +Requires: pkgconfig(glib-2.0) +Requires: pkgconfig(gobject-2.0) + +%description glib-devel +Development files needed for building things which link against %{name}-glib. + +%package -n compat-libical1 +Summary: Compat package with libical 1.0.1 libraries +Version: 1.0.1 +License: LGPLv2 or MPLv1.1 +# Explicitly conflict with older libical packages that ship libraries +# with the same soname as this compat package +Conflicts: libical < 3.0.0 + +%description -n compat-libical1 +Compatibility package with libical libraries ABI version 1. + +%prep +%setup -q +%patch1 -p1 -b .cmake-version + +%setup -T -D -a 1 + +pushd %{compat_build_dir} +%patch0 -p1 -b .avoid-putenv +popd + +%build + +# the compat package first +pushd %{compat_build_dir} +mkdir -p %{_target_platform} +pushd %{_target_platform} +%{cmake} .. +popd +make %{?_smp_mflags} -C %{_target_platform} +popd + +mkdir -p %{_target_platform} +pushd %{_target_platform} +%{cmake} .. \ + -DUSE_INTEROPERABLE_VTIMEZONES:BOOL=true \ + -DICAL_ALLOW_EMPTY_PROPERTIES:BOOL=true \ + -DGOBJECT_INTROSPECTION:BOOL=true \ + -DICAL_GLIB:BOOL=true \ + -DICAL_GLIB_VAPI:BOOL=true \ + -DSHARED_ONLY:BOOL=true +popd + +make %{?_smp_mflags} -C %{_target_platform} -j1 + +%install + +# the compat package first +pushd %{compat_build_dir} +make install/fast DESTDIR=%{buildroot} -C %{_target_platform} +# omit static libs +rm -fv %{buildroot}%{_libdir}/lib*.a +# Remove files that aren't needed for the compat package +rm -rf %{buildroot}%{_includedir} +rm -rf %{buildroot}%{_libdir}/*.so +rm -rf %{buildroot}%{_libdir}/cmake/ +rm -rf %{buildroot}%{_libdir}/pkgconfig/ +popd + +make install/fast DESTDIR=%{buildroot} -C %{_target_platform} + +%check +# the compat package first +pushd %{compat_build_dir} +make test ARGS="-V" -C %{_target_platform} +#popd + +make test ARGS="-V" -C %{_target_platform} + +%post -p /sbin/ldconfig + +%postun -p /sbin/ldconfig + +%files +%doc LICENSE ReadMe.txt THANKS +%{_libdir}/libical.so.3* +%{_libdir}/libical_cxx.so.3* +%{_libdir}/libicalss.so.3* +%{_libdir}/libicalss_cxx.so.3* +%{_libdir}/libicalvcal.so.3* +%{_libdir}/girepository-1.0/libical-%{gir_version}.typelib +%{_datadir}/gir-1.0/libical-%{gir_version}.gir + +%files devel +%doc doc/UsingLibical.txt +%{_libdir}/libical.so +%{_libdir}/libical_cxx.so +%{_libdir}/libicalss.so +%{_libdir}/libicalss_cxx.so +%{_libdir}/libicalvcal.so +%{_libdir}/pkgconfig/libical.pc +%{_libdir}/cmake/LibIcal/ +%{_includedir}/libical/ + +%files glib +%{_libdir}/libical-glib.so.3* +%{_libdir}/girepository-1.0/ICalGLib-3.0.typelib +%{_datadir}/gir-1.0/ICalGLib-3.0.gir + +%files glib-devel +%{_libdir}/libical-glib.so +%{_libdir}/pkgconfig/libical-glib.pc +%{_includedir}/libical-glib/ +%{_datadir}/vala/vapi/libical-glib.vapi + +%files glib-doc +%{_datadir}/gtk-doc/html/%{name}-glib + +%files -n compat-libical1 +%doc %{compat_build_dir}/LICENSE +%{_libdir}/libical.so.1* +%{_libdir}/libicalss.so.1* +%{_libdir}/libicalvcal.so.1* + +%changelog +* Tue Jun 19 2018 Milan Crha - 3.0.3-2 +- Update Requires of libical-glib-devel + +* Thu May 31 2018 Milan Crha - 3.0.3-1 +- Update to 3.0.3 and build compat-libical1 subpackage +- Resolves: #1584655 + +* Wed Jul 08 2015 Milan Crha - 1.0.1-1 +- Update to 1.0.1 + +* Fri Jan 24 2014 Daniel Mach - 0.48-6 +- Mass rebuild 2014-01-24 + +* Fri Dec 27 2013 Daniel Mach - 0.48-5 +- Mass rebuild 2013-12-27 + +* Thu Feb 14 2013 Fedora Release Engineering - 0.48-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild + +* Thu Jul 19 2012 Fedora Release Engineering - 0.48-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild + +* Fri Jan 13 2012 Fedora Release Engineering - 0.48-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild + +* Sat Dec 17 2011 Robert Scheck 0.48-1 +- Upgrade to 0.48 (#664412, #696891, #743236) + +* Mon Oct 24 2011 Robert Scheck 0.47-1 +- Upgrade to 0.47 (#743236) + +* Tue Feb 08 2011 Fedora Release Engineering - 0.46-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild + +* Sun Dec 19 2010 Robert Scheck 0.46-2 +- Added patch to work around upstream's broken AC_PROG_MKDIR_P + +* Sun Dec 19 2010 Robert Scheck 0.46-1 +- Upgrade to 0.46 (#525933, #628893) +- Fixed race in populating builtin timezone components (#637150) +- Fixed wrong ICAL_ERRORS_ARE_FATAL preprocessor check (#575715) + +* Fri Jul 24 2009 Fedora Release Engineering - 0.43-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild + +* Sun Mar 15 2009 Debarshi Ray - 0.43-4 +- Updated patch to fix #includes in the headers to work with + 'pkg-config --cflags libical'. (Red Hat Bugzilla #484091) + +* Wed Feb 25 2009 Release Engineering - 0.43-3 +- Autorebuild for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild + +* Tue Feb 17 2009 Debarshi Ray - 0.43-2 +- Added patch to fix CFLAGS in libical.pc. (Red Hat Bugzilla #484091) + +* Tue Jan 13 2009 Debarshi Ray - 0.43-1 +- Version bump to 0.43. +- Added patch to fix implicit pointer conversion from Debian. (Debian BTS + #511598) +- Upstream has switched off ICAL_ERRORS_ARE_FATAL by default. This behaviour + is being retained across all distributions, including Fedora 11. +- Added 'Requires: tzdata'. +- Enabled backtrace dumps in the syslog. + +* Thu Jan 08 2009 Debarshi Ray - 0.41-2 +- Switched off ICAL_ERRORS_ARE_FATAL for all distributions, except Fedora 11. + (Red Hat Bugzilla #478331) + +* Sun Nov 23 2008 Debarshi Ray - 0.41-1 +- Version bump to 0.41. (Red Hat Bugzilla #469252) +- Disabled C++ bindings. + +* Tue Oct 28 2008 Kevin Kofler - 0.40-1 +- Version bump to 0.40. (Red Hat Bugzilla #466359) +- Add patch from upstream to fix crash in icalvalue.c. +- Update makefile patch, remove the test part (already applied). +- Package libical.pc, add Requires: pkgconfig to -devel. + +* Tue Sep 02 2008 Debarshi Ray - 0.32-1 +- Version bump to 0.32. +- Parallel build problems fixed. + +* Sun Jul 27 2008 Jeff Perry - 0.31-3 +- Added 'BuildRequires: bison byacc flex'. + +* Sun Jul 27 2008 Debarshi Ray - 0.31-2 +- Fixed linkage problems and disabled parallel build till upstream accepts fix. + +* Thu Jul 17 2008 Jeff Perry - 0.31-1 +- Version bump to 0.31. + +* Thu Jul 17 2008 Debarshi Ray - 0.30-4 +- Changed value of License according to Fedora licensing guidelines. +- Enabled reentrant system calls and C++ bindings. +- Omitted unused direct shared library dependencies. +- Added ChangeLog, COPYING, LICENSE, NEWS and README to doc and dropped + examples. + +* Wed Apr 02 2008 Jakub 'Livio' Rusinek - 0.30-3 +- Source URL... Fixed + +* Wed Apr 02 2008 Jakub 'Livio' Rusinek - 0.30-2 +- Removed untrue note about libical's homepage (to get rid of eventuall mess) + +* Sat Feb 23 2008 David Nielsen - 0.30-1 +- Switch to freeassociation libical +- bump to 0.30 + +* Sat Feb 09 2008 Jakub 'Livio' Rusinek - 0.27-5 +- Mass rebuild for new GCC... Done + +* Sat Jan 19 2008 Jakub 'Livio' Rusinek - 0.27-4 +- Licence... Fixed + +* Fri Jan 18 2008 Jakub 'Livio' Rusinek - 0.27-3 +- Files section... Fixed + +* Thu Jan 17 2008 Jakub 'Livio' Rusinek - 0.27-2 +- Source... Changed +- Debug information in libical main package... Excluded +- Non-numbered .so files in libical main package... Moved +- libical-devel documentation... Added + +* Mon Dec 24 2007 Jakub 'Livio' Rusinek - 0.27-1 +- Initial release