init opengauss-server
This commit is contained in:
parent
90e680dcdf
commit
b15c04506a
133
0001-cJSON.patch
Executable file
133
0001-cJSON.patch
Executable file
@ -0,0 +1,133 @@
|
|||||||
|
From dec906196dc53e4aaa2937d1e57a8b3761a1b531 Mon Sep 17 00:00:00 2001
|
||||||
|
From: panggou <jiangjiangjun@huawei.com>
|
||||||
|
Date: Tue, 9 Mar 2021 11:11:59 +0800
|
||||||
|
Subject: [PATCH] =?UTF-8?q?[Huawei]=E5=AE=89=E5=85=A8=E7=BC=96=E8=AF=91?=
|
||||||
|
=?UTF-8?q?=E9=80=89=E9=A1=B9=EF=BC=8C=E9=80=82=E9=85=8D=E4=BA=A7=E5=93=81?=
|
||||||
|
=?UTF-8?q?=E4=BD=BF=E7=94=A8=E6=8E=A5=E5=8F=A3?=
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Type: text/plain; charset=UTF-8
|
||||||
|
Content-Transfer-Encoding: 8bit
|
||||||
|
|
||||||
|
Offering: GaussDB Kernel
|
||||||
|
Signed-off-by: jiangjiangjun@huawei.com
|
||||||
|
---
|
||||||
|
Makefile | 4 ++--
|
||||||
|
cJSON.c | 18 +++++++++---------
|
||||||
|
cJSON.h | 1 +
|
||||||
|
3 files changed, 12 insertions(+), 11 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/Makefile b/Makefile
|
||||||
|
index 4e727b7..1ee5a21 100644
|
||||||
|
--- a/Makefile
|
||||||
|
+++ b/Makefile
|
||||||
|
@@ -12,8 +12,8 @@ LIBVERSION = 1.7.13
|
||||||
|
CJSON_SOVERSION = 1
|
||||||
|
UTILS_SOVERSION = 1
|
||||||
|
|
||||||
|
-CJSON_SO_LDFLAG=-Wl,-soname=$(CJSON_LIBNAME).so.$(CJSON_SOVERSION)
|
||||||
|
-UTILS_SO_LDFLAG=-Wl,-soname=$(UTILS_LIBNAME).so.$(UTILS_SOVERSION)
|
||||||
|
+CJSON_SO_LDFLAG=-Wl,-z,relro,-z,now,-soname=$(CJSON_LIBNAME).so.$(CJSON_SOVERSION)
|
||||||
|
+UTILS_SO_LDFLAG=-Wl,-z,relro,-z,now,-soname=$(UTILS_LIBNAME).so.$(UTILS_SOVERSION)
|
||||||
|
|
||||||
|
PREFIX ?= /usr/local
|
||||||
|
INCLUDE_PATH ?= include/cjson
|
||||||
|
diff --git a/cJSON.c b/cJSON.c
|
||||||
|
index a5d3987..27c9388 100644
|
||||||
|
--- a/cJSON.c
|
||||||
|
+++ b/cJSON.c
|
||||||
|
@@ -181,7 +181,7 @@ static void * CJSON_CDECL internal_realloc(void *pointer, size_t size)
|
||||||
|
|
||||||
|
static internal_hooks global_hooks = { internal_malloc, internal_free, internal_realloc };
|
||||||
|
|
||||||
|
-static unsigned char* cJSON_strdup(const unsigned char* string, const internal_hooks * const hooks)
|
||||||
|
+CJSON_PUBLIC(unsigned char*) cJSON_strdup(const unsigned char* string)
|
||||||
|
{
|
||||||
|
size_t length = 0;
|
||||||
|
unsigned char *copy = NULL;
|
||||||
|
@@ -192,7 +192,7 @@ static unsigned char* cJSON_strdup(const unsigned char* string, const internal_h
|
||||||
|
}
|
||||||
|
|
||||||
|
length = strlen((const char*)string) + sizeof("");
|
||||||
|
- copy = (unsigned char*)hooks->allocate(length);
|
||||||
|
+ copy = (unsigned char*)global_hooks.allocate(length);
|
||||||
|
if (copy == NULL)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
@@ -406,7 +406,7 @@ CJSON_PUBLIC(char*) cJSON_SetValuestring(cJSON *object, const char *valuestring)
|
||||||
|
strcpy(object->valuestring, valuestring);
|
||||||
|
return object->valuestring;
|
||||||
|
}
|
||||||
|
- copy = (char*) cJSON_strdup((const unsigned char*)valuestring, &global_hooks);
|
||||||
|
+ copy = (char*) cJSON_strdup((const unsigned char*)valuestring);
|
||||||
|
if (copy == NULL)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
@@ -2020,7 +2020,7 @@ static cJSON_bool add_item_to_object(cJSON * const object, const char * const st
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
- new_key = (char*)cJSON_strdup((const unsigned char*)string, hooks);
|
||||||
|
+ new_key = (char*)cJSON_strdup((const unsigned char*)string);
|
||||||
|
if (new_key == NULL)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
@@ -2341,7 +2341,7 @@ static cJSON_bool replace_item_in_object(cJSON *object, const char *string, cJSO
|
||||||
|
{
|
||||||
|
cJSON_free(replacement->string);
|
||||||
|
}
|
||||||
|
- replacement->string = (char*)cJSON_strdup((const unsigned char*)string, &global_hooks);
|
||||||
|
+ replacement->string = (char*)cJSON_strdup((const unsigned char*)string);
|
||||||
|
replacement->type &= ~cJSON_StringIsConst;
|
||||||
|
|
||||||
|
return cJSON_ReplaceItemViaPointer(object, get_object_item(object, string, case_sensitive), replacement);
|
||||||
|
@@ -2434,7 +2434,7 @@ CJSON_PUBLIC(cJSON *) cJSON_CreateString(const char *string)
|
||||||
|
if(item)
|
||||||
|
{
|
||||||
|
item->type = cJSON_String;
|
||||||
|
- item->valuestring = (char*)cJSON_strdup((const unsigned char*)string, &global_hooks);
|
||||||
|
+ item->valuestring = (char*)cJSON_strdup((const unsigned char*)string);
|
||||||
|
if(!item->valuestring)
|
||||||
|
{
|
||||||
|
cJSON_Delete(item);
|
||||||
|
@@ -2484,7 +2484,7 @@ CJSON_PUBLIC(cJSON *) cJSON_CreateRaw(const char *raw)
|
||||||
|
if(item)
|
||||||
|
{
|
||||||
|
item->type = cJSON_Raw;
|
||||||
|
- item->valuestring = (char*)cJSON_strdup((const unsigned char*)raw, &global_hooks);
|
||||||
|
+ item->valuestring = (char*)cJSON_strdup((const unsigned char*)raw);
|
||||||
|
if(!item->valuestring)
|
||||||
|
{
|
||||||
|
cJSON_Delete(item);
|
||||||
|
@@ -2686,7 +2686,7 @@ CJSON_PUBLIC(cJSON *) cJSON_Duplicate(const cJSON *item, cJSON_bool recurse)
|
||||||
|
newitem->valuedouble = item->valuedouble;
|
||||||
|
if (item->valuestring)
|
||||||
|
{
|
||||||
|
- newitem->valuestring = (char*)cJSON_strdup((unsigned char*)item->valuestring, &global_hooks);
|
||||||
|
+ newitem->valuestring = (char*)cJSON_strdup((unsigned char*)item->valuestring);
|
||||||
|
if (!newitem->valuestring)
|
||||||
|
{
|
||||||
|
goto fail;
|
||||||
|
@@ -2694,7 +2694,7 @@ CJSON_PUBLIC(cJSON *) cJSON_Duplicate(const cJSON *item, cJSON_bool recurse)
|
||||||
|
}
|
||||||
|
if (item->string)
|
||||||
|
{
|
||||||
|
- newitem->string = (item->type&cJSON_StringIsConst) ? item->string : (char*)cJSON_strdup((unsigned char*)item->string, &global_hooks);
|
||||||
|
+ newitem->string = (item->type&cJSON_StringIsConst) ? item->string : (char*)cJSON_strdup((unsigned char*)item->string);
|
||||||
|
if (!newitem->string)
|
||||||
|
{
|
||||||
|
goto fail;
|
||||||
|
diff --git a/cJSON.h b/cJSON.h
|
||||||
|
index 0c6c8e0..4481dfd 100644
|
||||||
|
--- a/cJSON.h
|
||||||
|
+++ b/cJSON.h
|
||||||
|
@@ -286,6 +286,7 @@ CJSON_PUBLIC(char*) cJSON_SetValuestring(cJSON *object, const char *valuestring)
|
||||||
|
CJSON_PUBLIC(void *) cJSON_malloc(size_t size);
|
||||||
|
CJSON_PUBLIC(void) cJSON_free(void *object);
|
||||||
|
|
||||||
|
+CJSON_PUBLIC(unsigned char*) cJSON_strdup(const unsigned char* string);
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
--
|
||||||
|
2.23.0
|
||||||
|
|
||||||
356895
0001-orc.patch
Executable file
356895
0001-orc.patch
Executable file
File diff suppressed because it is too large
Load Diff
50
0001-zlib.patch
Executable file
50
0001-zlib.patch
Executable file
@ -0,0 +1,50 @@
|
|||||||
|
From 32efb3e42f67bc300a26c21837e4cc5813444be4 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Mark Adler <madler@alumni.caltech.edu>
|
||||||
|
Date: Thu, 17 Sep 2020 11:09:46 -0700
|
||||||
|
Subject: [PATCH 1/3] [Backport] Change macro name
|
||||||
|
|
||||||
|
Reference: https://github.com/madler/zlib/commit/53ce2713117ef2a8ed682d77b944df991c499252
|
||||||
|
|
||||||
|
Change macro name in inflate.c to avoid collision in VxWorks.
|
||||||
|
---
|
||||||
|
inflate.c | 8 ++++----
|
||||||
|
1 file changed, 4 insertions(+), 4 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/inflate.c b/inflate.c
|
||||||
|
index ac333e8..36a6120 100644
|
||||||
|
--- a/inflate.c
|
||||||
|
+++ b/inflate.c
|
||||||
|
@@ -447,10 +447,10 @@ unsigned copy;
|
||||||
|
|
||||||
|
/* check function to use adler32() for zlib or crc32() for gzip */
|
||||||
|
#ifdef GUNZIP
|
||||||
|
-# define UPDATE(check, buf, len) \
|
||||||
|
+# define UPDATE_CHECK(check, buf, len) \
|
||||||
|
(state->flags ? crc32(check, buf, len) : adler32(check, buf, len))
|
||||||
|
#else
|
||||||
|
-# define UPDATE(check, buf, len) adler32(check, buf, len)
|
||||||
|
+# define UPDATE_CHECK(check, buf, len) adler32(check, buf, len)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* check macros for header crc */
|
||||||
|
@@ -1202,7 +1202,7 @@ int flush;
|
||||||
|
state->total += out;
|
||||||
|
if ((state->wrap & 4) && out)
|
||||||
|
strm->adler = state->check =
|
||||||
|
- UPDATE(state->check, put - out, out);
|
||||||
|
+ UPDATE_CHECK(state->check, put - out, out);
|
||||||
|
out = left;
|
||||||
|
if ((state->wrap & 4) && (
|
||||||
|
#ifdef GUNZIP
|
||||||
|
@@ -1265,7 +1265,7 @@ int flush;
|
||||||
|
state->total += out;
|
||||||
|
if ((state->wrap & 4) && out)
|
||||||
|
strm->adler = state->check =
|
||||||
|
- UPDATE(state->check, strm->next_out - out, out);
|
||||||
|
+ UPDATE_CHECK(state->check, strm->next_out - out, out);
|
||||||
|
strm->data_type = (int)state->bits + (state->last ? 64 : 0) +
|
||||||
|
(state->mode == TYPE ? 128 : 0) +
|
||||||
|
(state->mode == LEN_ || state->mode == COPY_ ? 256 : 0);
|
||||||
|
--
|
||||||
|
2.23.0
|
||||||
|
|
||||||
22
0002-zlib.patch
Executable file
22
0002-zlib.patch
Executable file
@ -0,0 +1,22 @@
|
|||||||
|
From dcedd0810b00ba065de07386bc270eea57aa157a Mon Sep 17 00:00:00 2001
|
||||||
|
From: yuangongji 00362270 <yuangongji1@huawei.com>
|
||||||
|
Date: Tue, 20 Oct 2020 17:24:41 +0800
|
||||||
|
Subject: [PATCH 2/3] [Huawei] add release file for h1
|
||||||
|
|
||||||
|
Offering: Open Source Competence Center
|
||||||
|
---
|
||||||
|
HUAWEI-RELEASE | 1 +
|
||||||
|
1 file changed, 1 insertion(+)
|
||||||
|
create mode 100644 HUAWEI-RELEASE
|
||||||
|
|
||||||
|
diff --git a/HUAWEI-RELEASE b/HUAWEI-RELEASE
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000..787b9cc
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/HUAWEI-RELEASE
|
||||||
|
@@ -0,0 +1 @@
|
||||||
|
+RELEASE: h1
|
||||||
|
\ No newline at end of file
|
||||||
|
--
|
||||||
|
2.23.0
|
||||||
|
|
||||||
63
0003-zlib.patch
Executable file
63
0003-zlib.patch
Executable file
@ -0,0 +1,63 @@
|
|||||||
|
From 466c5b509e668e5d211e919ef6d1fc360e4269f4 Mon Sep 17 00:00:00 2001
|
||||||
|
From: xukunpeng <xukunpeng2@huawei.com>
|
||||||
|
Date: Tue, 13 Apr 2021 11:06:05 +0800
|
||||||
|
Subject: [PATCH 3/3] [Huawei]patch to zlib
|
||||||
|
|
||||||
|
Offering: GaussDB Kernel
|
||||||
|
|
||||||
|
More detail: patch huawei_unzip_alloc_hook.patch and huawei_unzip_alloc_hook.patch2
|
||||||
|
|
||||||
|
Signed-off-by: xukunpeng xukunpeng2@huawei.com
|
||||||
|
---
|
||||||
|
contrib/minizip/unzip.c | 10 ++++++++++
|
||||||
|
contrib/minizip/unzip.h | 13 +++++++++++++
|
||||||
|
2 files changed, 23 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/contrib/minizip/unzip.c b/contrib/minizip/unzip.c
|
||||||
|
index bcfb941..a321034 100644
|
||||||
|
--- a/contrib/minizip/unzip.c
|
||||||
|
+++ b/contrib/minizip/unzip.c
|
||||||
|
@@ -108,6 +108,16 @@
|
||||||
|
#define UNZ_MAXFILENAMEINZIP (256)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
+static unz_memfunc g_unz_memapi = {0, 0};
|
||||||
|
+
|
||||||
|
+extern int ZEXPORT unz_set_memfuncs(const unz_memfunc* memfunc)
|
||||||
|
+{
|
||||||
|
+ g_unz_memapi = *memfunc;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+#define ALLOC(size) ((*(g_unz_memapi.m_malloc))(size))
|
||||||
|
+#define TRYFREE(p) { if (p) { (*(g_unz_memapi.m_free))(p); p = NULL; } }
|
||||||
|
+
|
||||||
|
#ifndef ALLOC
|
||||||
|
# define ALLOC(size) (malloc(size))
|
||||||
|
#endif
|
||||||
|
diff --git a/contrib/minizip/unzip.h b/contrib/minizip/unzip.h
|
||||||
|
index 2104e39..06eb49c 100644
|
||||||
|
--- a/contrib/minizip/unzip.h
|
||||||
|
+++ b/contrib/minizip/unzip.h
|
||||||
|
@@ -429,6 +429,19 @@ extern int ZEXPORT unzSetOffset64 (unzFile file, ZPOS64_T pos);
|
||||||
|
extern int ZEXPORT unzSetOffset (unzFile file, uLong pos);
|
||||||
|
|
||||||
|
|
||||||
|
+/* memory manager api */
|
||||||
|
+typedef voidp (* malloc_pf) (size_t);
|
||||||
|
+typedef void (* free_pf) (voidp);
|
||||||
|
+
|
||||||
|
+typedef struct unz_memfunc_s
|
||||||
|
+{
|
||||||
|
+ malloc_pf m_malloc;
|
||||||
|
+ free_pf m_free;
|
||||||
|
+} unz_memfunc;
|
||||||
|
+
|
||||||
|
+extern int ZEXPORT unz_set_memfuncs OF ((const unz_memfunc* memfunc));
|
||||||
|
+
|
||||||
|
+
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
--
|
||||||
|
2.23.0
|
||||||
|
|
||||||
36
README.en.md
36
README.en.md
@ -1,36 +0,0 @@
|
|||||||
# opengauss-server
|
|
||||||
|
|
||||||
#### Description
|
|
||||||
openGauss is an open source relational database management system
|
|
||||||
|
|
||||||
#### Software Architecture
|
|
||||||
Software architecture description
|
|
||||||
|
|
||||||
#### Installation
|
|
||||||
|
|
||||||
1. xxxx
|
|
||||||
2. xxxx
|
|
||||||
3. xxxx
|
|
||||||
|
|
||||||
#### Instructions
|
|
||||||
|
|
||||||
1. xxxx
|
|
||||||
2. xxxx
|
|
||||||
3. xxxx
|
|
||||||
|
|
||||||
#### Contribution
|
|
||||||
|
|
||||||
1. Fork the repository
|
|
||||||
2. Create Feat_xxx branch
|
|
||||||
3. Commit your code
|
|
||||||
4. Create Pull Request
|
|
||||||
|
|
||||||
|
|
||||||
#### Gitee Feature
|
|
||||||
|
|
||||||
1. You can use Readme\_XXX.md to support different languages, such as Readme\_en.md, Readme\_zh.md
|
|
||||||
2. Gitee blog [blog.gitee.com](https://blog.gitee.com)
|
|
||||||
3. Explore open source project [https://gitee.com/explore](https://gitee.com/explore)
|
|
||||||
4. The most valuable open source project [GVP](https://gitee.com/gvp)
|
|
||||||
5. The manual of Gitee [https://gitee.com/help](https://gitee.com/help)
|
|
||||||
6. The most popular members [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)
|
|
||||||
37
README.md
37
README.md
@ -1,37 +0,0 @@
|
|||||||
# opengauss-server
|
|
||||||
|
|
||||||
#### 介绍
|
|
||||||
openGauss is an open source relational database management system
|
|
||||||
|
|
||||||
#### 软件架构
|
|
||||||
软件架构说明
|
|
||||||
|
|
||||||
|
|
||||||
#### 安装教程
|
|
||||||
|
|
||||||
1. xxxx
|
|
||||||
2. xxxx
|
|
||||||
3. xxxx
|
|
||||||
|
|
||||||
#### 使用说明
|
|
||||||
|
|
||||||
1. xxxx
|
|
||||||
2. xxxx
|
|
||||||
3. xxxx
|
|
||||||
|
|
||||||
#### 参与贡献
|
|
||||||
|
|
||||||
1. Fork 本仓库
|
|
||||||
2. 新建 Feat_xxx 分支
|
|
||||||
3. 提交代码
|
|
||||||
4. 新建 Pull Request
|
|
||||||
|
|
||||||
|
|
||||||
#### 特技
|
|
||||||
|
|
||||||
1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md
|
|
||||||
2. Gitee 官方博客 [blog.gitee.com](https://blog.gitee.com)
|
|
||||||
3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解 Gitee 上的优秀开源项目
|
|
||||||
4. [GVP](https://gitee.com/gvp) 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目
|
|
||||||
5. Gitee 官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help)
|
|
||||||
6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)
|
|
||||||
BIN
cJSON-1.7.13.tar.gz
Executable file
BIN
cJSON-1.7.13.tar.gz
Executable file
Binary file not shown.
35
makefile-miniunz.patch
Executable file
35
makefile-miniunz.patch
Executable file
@ -0,0 +1,35 @@
|
|||||||
|
diff -crN zlib-1.2.11-org/contrib/minizip/Makefile.miniunz zlib-1.2.11/contrib/minizip/Makefile.miniunz
|
||||||
|
*** zlib-1.2.11-org/contrib/minizip/Makefile.miniunz 1970-01-01 08:00:00.000000000 +0800
|
||||||
|
--- zlib-1.2.11/contrib/minizip/Makefile.miniunz 2021-11-10 16:00:17.706436344 +0800
|
||||||
|
***************
|
||||||
|
*** 0 ****
|
||||||
|
--- 1,29 ----
|
||||||
|
+ CC=cc
|
||||||
|
+ # CFLAGS=-g -O0 -O -I../..
|
||||||
|
+ CFLAGS=-O3 -fPIC -I../..
|
||||||
|
+ ARFLAGS=rc
|
||||||
|
+ AR=ar
|
||||||
|
+
|
||||||
|
+ UNZ_OBJS = unzip.o ioapi.o
|
||||||
|
+ LIB_COMMON = libminiunz.a
|
||||||
|
+
|
||||||
|
+ .c.o:
|
||||||
|
+ $(CC) -c $(CFLAGS) $*.c
|
||||||
|
+
|
||||||
|
+ all: $(LIB_COMMON)
|
||||||
|
+
|
||||||
|
+ $(LIB_COMMON) : $(UNZ_OBJS)
|
||||||
|
+ $(AR) $(ARFLAGS) $@ $(UNZ_OBJS)
|
||||||
|
+
|
||||||
|
+ $(UNZ_OBJS):%.o:%.c
|
||||||
|
+ $(CC) -c $(CFLAGS) $*.c
|
||||||
|
+ # $(CC) $(CFLAGS) -O $@ -c $<
|
||||||
|
+
|
||||||
|
+ install:
|
||||||
|
+ cp ioapi.h $(DESTDIR)/include/
|
||||||
|
+ cp unzip.h $(DESTDIR)/include/
|
||||||
|
+ cp libminiunz.a $(DESTDIR)/lib/
|
||||||
|
+ chmod 644 $(DESTDIR)/include/ioapi.h $(DESTDIR)/include/unzip.h $(DESTDIR)/lib/libminiunz.a
|
||||||
|
+
|
||||||
|
+ clean:
|
||||||
|
+ /bin/rm -f *.o *.a
|
||||||
BIN
openGauss-server-2.1.0.tar.xz
Normal file
BIN
openGauss-server-2.1.0.tar.xz
Normal file
Binary file not shown.
7
opengauss-bashprofile
Normal file
7
opengauss-bashprofile
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
[ -f /etc/profile ] && source /etc/profile
|
||||||
|
|
||||||
|
export GAUSSHOME=/usr/local/opengauss/
|
||||||
|
export LD_LIBRARY_PATH=/usr/local/opengauss/lib:$LD_LIBRARY_PATH
|
||||||
|
export PATH=/usr/local/opengauss/bin:$PATH
|
||||||
|
export PGDATA=/var/lib/opengauss/data
|
||||||
|
export PORT=7654
|
||||||
229
opengauss-server.spec
Normal file
229
opengauss-server.spec
Normal file
@ -0,0 +1,229 @@
|
|||||||
|
%define cjson_name cJSON
|
||||||
|
%define cjson_version 1.7.13
|
||||||
|
%define zlib_name zlib
|
||||||
|
%define zlib_version 1.2.11
|
||||||
|
%define protobuf_name protobuf
|
||||||
|
%define protobuf_version 3.11.3
|
||||||
|
%define orc_name orc-rel-release
|
||||||
|
%define orc_version 1.6.0
|
||||||
|
%define port 7654
|
||||||
|
%define datapath /var/lib/opengauss
|
||||||
|
%define apppath %{_prefix}/local/opengauss
|
||||||
|
|
||||||
|
Name: opengauss
|
||||||
|
Version: 2.1.0
|
||||||
|
Release: 1
|
||||||
|
Summary: openGauss is an open source relational database management system
|
||||||
|
License: MulanPSL-2.0 and MIT and BSD and zlib
|
||||||
|
URL: https://gitee.com/opengauss/openGauss-server
|
||||||
|
Source0: openGauss-server-%{version}.tar.xz
|
||||||
|
Source1: %{cjson_name}-%{cjson_version}.tar.gz
|
||||||
|
Source2: %{zlib_name}-%{zlib_version}.tar.gz
|
||||||
|
Source3: %{protobuf_name}-%{protobuf_version}.tar.gz
|
||||||
|
Source4: %{orc_name}-%{orc_version}.tar.gz
|
||||||
|
Source5: opengauss-bashprofile
|
||||||
|
|
||||||
|
Patch1: 0001-cJSON.patch
|
||||||
|
Patch20: 0001-zlib.patch
|
||||||
|
Patch21: 0002-zlib.patch
|
||||||
|
Patch22: 0003-zlib.patch
|
||||||
|
Patch23: makefile-miniunz.patch
|
||||||
|
Patch40: 0001-orc.patch
|
||||||
|
|
||||||
|
BuildRequires: cmake gcc gcc-c++ openssl-devel python
|
||||||
|
BuildRequires: cjson lz4-devel protobuf-devel snappy-devel zstd-devel boost-devel
|
||||||
|
BuildRequires: libcgroup-devel curl-devel unixODBC-devel jemalloc-devel
|
||||||
|
BuildRequires: java-1.8.0-openjdk-devel libedit-devel libaio-devel
|
||||||
|
BuildRequires: bison flex DCF
|
||||||
|
%ifnarch aarch64 %{arm}
|
||||||
|
BuildRequires: numactl-devel
|
||||||
|
%endif
|
||||||
|
|
||||||
|
|
||||||
|
Requires: lz4-devel protobuf-devel snappy-devel zstd-devel boost-devel
|
||||||
|
Requires: libcgroup-devel curl-devel unixODBC-devel jemalloc-devel
|
||||||
|
Requires: java-1.8.0-openjdk-devel libedit-devel libaio-devel
|
||||||
|
Requires: DCF
|
||||||
|
%ifnarch aarch64 %{arm}
|
||||||
|
Requires: numactl-devel
|
||||||
|
%endif
|
||||||
|
|
||||||
|
%description
|
||||||
|
openGauss kernel : openGauss is an open source relational database management system.
|
||||||
|
|
||||||
|
%Provides: gaussdb
|
||||||
|
|
||||||
|
%global debug_package %{nil}
|
||||||
|
|
||||||
|
%prep
|
||||||
|
%setup -q -c -n %{name}-%{version}
|
||||||
|
%setup -q -D -T -a 1
|
||||||
|
%setup -q -D -T -a 2
|
||||||
|
%setup -q -D -T -a 3
|
||||||
|
%setup -q -D -T -a 4
|
||||||
|
|
||||||
|
|
||||||
|
pushd %{cjson_name}-%{cjson_version}
|
||||||
|
%patch1 -p1
|
||||||
|
popd
|
||||||
|
|
||||||
|
pushd %{zlib_name}-%{zlib_version}
|
||||||
|
%patch20 -p1
|
||||||
|
%patch21 -p1
|
||||||
|
%patch22 -p1
|
||||||
|
%patch23 -p1
|
||||||
|
popd
|
||||||
|
|
||||||
|
pushd %{orc_name}-%{orc_version}
|
||||||
|
%patch40 -p1
|
||||||
|
popd
|
||||||
|
|
||||||
|
%build
|
||||||
|
########### build cjson ###########
|
||||||
|
build_target=$(pwd)/deps_binarylibs
|
||||||
|
|
||||||
|
pushd %{cjson_name}-%{cjson_version}
|
||||||
|
make
|
||||||
|
make install PREFIX=${build_target}/cjson
|
||||||
|
popd
|
||||||
|
|
||||||
|
########### build zlib ###########
|
||||||
|
pushd %{zlib_name}-%{zlib_version}
|
||||||
|
CONFIGURE_EXTRA_FLAG="--64"
|
||||||
|
%ifarch aarch64
|
||||||
|
CONFIGURE_EXTRA_FLAG=""
|
||||||
|
%endif
|
||||||
|
./configure ${CONFIGURE_EXTRA_FLAG} --prefix=${build_target}/zlib
|
||||||
|
sed -i '21a CFLAGS += -fPIC' Makefile
|
||||||
|
MAKE_EXTRA_FLAG="-m64"
|
||||||
|
%ifarch aarch64
|
||||||
|
MAKE_EXTRA_FLAG=""
|
||||||
|
%endif
|
||||||
|
make CFLAGS="-fPIE -fPIC" SFLAGS="-O2 -fPIC -fstack-protector-strong -Wl,-z,noexecstack -Wl,-z,relro,-z,now ${MAKE_EXTRA_FLAG} -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN" %{?_smp_mflags}
|
||||||
|
make install
|
||||||
|
cd contrib/minizip/
|
||||||
|
make -f Makefile.miniunz %{?_smp_mflags}
|
||||||
|
rm -rf ${build_target}/zlib/lib/pkgconfig
|
||||||
|
make install -f Makefile.miniunz DESTDIR=${build_target}/zlib
|
||||||
|
popd
|
||||||
|
|
||||||
|
########### build protobuf ###########
|
||||||
|
pushd %{protobuf_name}-%{protobuf_version}/cmake
|
||||||
|
sed -i '18a set(CMAKE_CXX_FLAGS \"${CMAKE_CXX_FLAGS} -fPIE -fPIC -fstack-protector-all -Wstack-protector -s -Wl,-z,relro,-z,now -D_GLIBCXX_USE_CXX11_ABI=0\")' CMakeLists.txt
|
||||||
|
cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=${build_target}/protobuf/ -Dprotobuf_BUILD_TESTS=OFF;
|
||||||
|
make CFLAGS="-fPIE -fPIC" %{?_smp_mflags}
|
||||||
|
make install
|
||||||
|
popd
|
||||||
|
|
||||||
|
########### build apache-orc ###########
|
||||||
|
pushd %{orc_name}-%{orc_version}
|
||||||
|
cp ${build_target}/protobuf ./c++/libs/protobuf -rp
|
||||||
|
cp ${build_target}/zlib ./c++/libs/zlib -rp
|
||||||
|
export PATH=${build_target}/protobuf/bin:$PATH
|
||||||
|
export LD_LIBRARY_PATH=$(pwd)/c++/libs:$LD_LIBRARY_PATH
|
||||||
|
export ORC_LIBS=$(pwd)/c++/libs
|
||||||
|
sed -i \
|
||||||
|
-e "32a set (PROTOBUF_INCLUDE_DIRS \"$ORC_LIBS/protobuf/include\")" \
|
||||||
|
-e "32a set (PROTOBUF_LIBRARIES \"$ORC_LIBS/protobuf/lib/libprotobuf.a\")" \
|
||||||
|
-e "32a set (PROTOBUF_EXECUTABLE `which protoc`)" \
|
||||||
|
-e "32a set (SNAPPY_INCLUDE_DIRS \"/usr/include\")" \
|
||||||
|
-e "32a set (SNAPPY_LIBRARIES \"/usr/lib64/libsnappy.a\")" \
|
||||||
|
-e "32a set (ZLIB_INCLUDE_DIRS \"$ORC_LIBS/zlib/include\")" \
|
||||||
|
-e "32a set (ZLIB_LIBRARIES \"$ORC_LIBS/zlib/lib/libz.a\")" \
|
||||||
|
-e "32a set (LZ4_INCLUDE_DIRS \"/usr/include\")" \
|
||||||
|
-e "32a set (LZ4_LIBRARIES \"/usr/lib64/liblz4.a\")" CMakeLists.txt
|
||||||
|
mkdir build
|
||||||
|
cd build
|
||||||
|
cmake .. -DCMAKE_INSTALL_PREFIX=${build_target}/liborc -DBUILD_JAVA=OFF -DBUILD_SHARED_LIBS=OFF
|
||||||
|
make %{?_smp_mflags}
|
||||||
|
make install
|
||||||
|
cp c++/src/orc_proto.pb.h ${build_target}/liborc/include
|
||||||
|
cp c++/src/Adaptor.hh ${build_target}/liborc/include/orc/
|
||||||
|
cp ../c++/src/Exceptions.hh ${build_target}/liborc/include/orc/
|
||||||
|
popd
|
||||||
|
|
||||||
|
########### build opengauss ###########
|
||||||
|
pushd openGauss-server-%{version}
|
||||||
|
chmod +x ./configure
|
||||||
|
./configure \
|
||||||
|
CC=g++ CFLAGS='-O2 -g3' \
|
||||||
|
--prefix=%{apppath} \
|
||||||
|
--3rd=${build_target} \
|
||||||
|
--enable-thread-safety \
|
||||||
|
--with-readline \
|
||||||
|
--without-zlib \
|
||||||
|
--without-gssapi \
|
||||||
|
--without-krb5 \
|
||||||
|
--enable-lite-mode \
|
||||||
|
--with-openeuler-os
|
||||||
|
%make_build %{?_smp_mflags}
|
||||||
|
popd
|
||||||
|
|
||||||
|
%install
|
||||||
|
pushd openGauss-server-%{version}
|
||||||
|
%make_install -s %{?_smp_mflags}
|
||||||
|
mkdir -p %{buildroot}/var/lib/opengauss/data
|
||||||
|
cp build/script/opengauss_config_file_mini %{buildroot}/%{apppath}/share/postgresql/
|
||||||
|
popd
|
||||||
|
|
||||||
|
# opengauss datanode dir.
|
||||||
|
install -d -m 700 $RPM_BUILD_ROOT%{?_localstatedir}/lib/opengauss/data
|
||||||
|
|
||||||
|
# opengauss .bash_profile
|
||||||
|
install -m 644 %{SOURCE5} $RPM_BUILD_ROOT%{?_localstatedir}/lib/opengauss/.bash_profile
|
||||||
|
|
||||||
|
%pre
|
||||||
|
/usr/sbin/groupadd -g 39 -o -r opengauss >/dev/null 2>&1 || :
|
||||||
|
/usr/sbin/useradd -M -N -g opengauss -o -r -d %{datapath} -s /bin/bash \
|
||||||
|
-c "openGauss Server" -u 39 opengauss >/dev/null 2>&1 || :
|
||||||
|
|
||||||
|
%post
|
||||||
|
# set opengauss mini config parameters
|
||||||
|
set_mini_configparam(){
|
||||||
|
config_mini_file=%{apppath}/share/postgresql/opengauss_config_file_mini
|
||||||
|
echo "port = %{port}" >> ${config_mini_file}
|
||||||
|
|
||||||
|
config_sample_file=%{apppath}/share/postgresql/postgresql.conf.sample
|
||||||
|
if [[ -f $config_mini_file ]]
|
||||||
|
then
|
||||||
|
if [[ ! -f "$config_sample_file" ]]
|
||||||
|
then
|
||||||
|
echo "postgresql.conf.sample does not exist"
|
||||||
|
else
|
||||||
|
echo "set opengauss lite config parameters"
|
||||||
|
while IFS= read -r line; do
|
||||||
|
SUBSTRING=$(echo $line | cut -d'=' -f 1)"= "
|
||||||
|
if grep -q "$SUBSTRING" $config_sample_file ; then
|
||||||
|
sed -i "/$SUBSTRING/c$line" $config_sample_file
|
||||||
|
else
|
||||||
|
echo $line >> $config_sample_file
|
||||||
|
fi
|
||||||
|
done < $config_mini_file
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
}
|
||||||
|
set_mini_configparam
|
||||||
|
|
||||||
|
su - opengauss -c "source ~/.bash_profile; gs_initdb -D /var/lib/opengauss/data -U opengauss --nodename=single_node"
|
||||||
|
su - opengauss -c "source ~/.bash_profile; gs_ctl start -D /var/lib/opengauss/data"
|
||||||
|
|
||||||
|
|
||||||
|
%postun
|
||||||
|
|
||||||
|
%preun
|
||||||
|
|
||||||
|
|
||||||
|
%files
|
||||||
|
%defattr (-,root,root)
|
||||||
|
%{apppath}
|
||||||
|
%doc
|
||||||
|
%{?_localstatedir}/lib/opengauss
|
||||||
|
%attr(700,opengauss,opengauss) %dir %{?_localstatedir}/lib/opengauss
|
||||||
|
%attr(700,opengauss,opengauss) %dir %{?_localstatedir}/lib/opengauss/data
|
||||||
|
%attr(644,opengauss,opengauss) %config(noreplace) %{?_localstatedir}/lib/opengauss/.bash_profile
|
||||||
|
|
||||||
|
|
||||||
|
%changelog
|
||||||
|
* Wed Dec 1 2021 zhangxubo <zhangxubo1@huawei.com> - 2.1.0-1
|
||||||
|
- Package init
|
||||||
BIN
orc-rel-release-1.6.0.tar.gz
Executable file
BIN
orc-rel-release-1.6.0.tar.gz
Executable file
Binary file not shown.
BIN
protobuf-3.11.3.tar.gz
Executable file
BIN
protobuf-3.11.3.tar.gz
Executable file
Binary file not shown.
BIN
zlib-1.2.11.tar.gz
Executable file
BIN
zlib-1.2.11.tar.gz
Executable file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user