8000 Add install timezones. issue #3 · roman0yurin/postgres@b80f552 · GitHub
[go: up one dir, main page]

Skip to content

Commit b80f552

Browse files
committed
Add install timezones. issue postgres#3
1 parent 811664a commit b80f552

File tree

4 files changed

+60
-14
lines changed

4 files changed

+60
-14
lines changed

CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,8 @@ check_type_size("struct sockaddr_un" HAVE_UNIX_SOCKETS)
371371
set(CMAKE_EXTRA_INCLUDE_FILES "netinet/in.h")
372372
check_type_size("struct sockaddr_in6" HAVE_IPV6)
373373

374+
check_include_file("sys/stat.h" HAVE_SYS_STAT_H)
375+
374376
if(WIN32)
375377
set(USE_WIN32_SEMAPHORES 1)
376378
set(SEMA_IMPLEMENTATION "${PROJECT_SOURCE_DIR}/src/backend/port/win32_sema.c")

src/include/pg_config_cmake.in

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,8 @@
186186
#cmakedefine HAVE_SYS_SEM_H
187187
#cmakedefine HAVE_SYS_SHM_H
188188

189+
#cmakedefine HAVE_SYS_STAT_H
190+
189191
#cmakedefine HAVE_FLS
190192

191193
#cmakedefine HAVE_SHM_OPEN

src/timezone/CMakeLists.txt

Lines changed: 55 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,58 @@
11
#TODO compile timezones
22

3+
include_directories(
4+
"${PROJECT_SOURCE_DIR}/src/include/libpq"
5+
"${PROJECT_SOURCE_DIR}/src/interfaces/libpq"
6+
"${PROJECT_SOURCE_DIR}/src/bin/pg_dump"
7+
)
8+
9+
10+
set(tzdata
11+
${CMAKE_CURRENT_SOURCE_DIR}/data/africa
12+
${CMAKE_CURRENT_SOURCE_DIR}/data/antarctica
13+
${CMAKE_CURRENT_SOURCE_DIR}/data/asia
14+
${CMAKE_CURRENT_SOURCE_DIR}/data/australasia
15+
${CMAKE_CURRENT_SOURCE_DIR}/data/europe
16+
${CMAKE_CURRENT_SOURCE_DIR}/data/northamerica
17+
${CMAKE_CURRENT_SOURCE_DIR}/data/southamerica
18+
${CMAKE_CURRENT_SOURCE_DIR}/data/pacificnew
19+
${CMAKE_CURRENT_SOURCE_DIR}/data/etcetera
20+
${CMAKE_CURRENT_SOURCE_DIR}/data/factory
21+
${CMAKE_CURRENT_SOURCE_DIR}/data/backward
22+
${CMAKE_CURRENT_SOURCE_DIR}/data/systemv
23+
)
24+
25+
add_executable(zic
26+
zic.c
27+
ialloc.c
28+
scheck.c
29+
localtime.c
30+
)
31+
target_link_libraries(zic
32+
port
33+
)
34+
335
install(FILES
4-
tznames/Africa.txt
5-
tznames/America.txt
6-
tznames/Antarctica.txt
7-
tznames/Asia.txt
8-
tznames/Atlantic.txt
9-
tznames/Australia.txt
10-
tznames/Etc.txt
11-
tznames/Europe.txt
12-
tznames/Indian.txt
13-
tznames/Pacific.txt
14-
tznames/Default
15-
tznames/Australia
16-
tznames/India
17-
DESTINATION ${PGSHAREDIR}/timezonesets)
36+
tznames/Africa.txt
37+
tznames/America.txt
38+
tznames/Antarctica.txt
39+
tznames/Asia.txt
40+
tznames/Atlantic.txt
41+
tznames/Australia.txt
42+
tznames/Etc.txt
43+
tznames/Europe.txt
44+
tznames/Indian.txt
45+
tznames/Pacific.txt
46+
tznames/Default
47+
tznames/Australia
48+
tznames/India
49+
DESTINATION ${PGSHAREDIR}/timezonesets)
50+
51+
function(JOIN VALUES GLUE OUTPUT)
52+
string (REGEX REPLACE "([^\\]|^);" "\\1${GLUE}" _TMP_STR "${VALUES}")
53+
string (REGEX REPLACE "[\\](.)" "\\1" _TMP_STR "${_TMP_STR}") #fixes escaping
54+
set (${OUTPUT} "${_TMP_STR}" PARENT_SCOPE)
55+
endfunction()
56+
57+
JOIN("${tzdata}" " " tzdata_string)
58+
install(CODE "execute_process(COMMAND ${CMAKE_CURRENT_BINARY_DIR}/zic -d \"${PGSHAREDIR}/timezone\" -p \"US/Eastern\" ${tzdata_string})")

src/timezone/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ zic: $(ZICOBJS) | submake-libpgport
5454

5555
install: all installdirs
5656
ifeq (,$(with_system_tzdata))
57+
echo "-d '$(DESTDIR)$(datadir)/timezone' -p '$(POSIXRULES)' $(TZDATAFILES)"
5758
$(ZIC) -d '$(DESTDIR)$(datadir)/timezone' -p '$(POSIXRULES)' $(TZDATAFILES)
5859
endif
5960
$(MAKE) -C tznames $@

0 commit comments

Comments
 (0)
0