Making Go package source distributable and renaming to 'nginx/unit'.

All header files are copied to Go package sources.  As the result,
package can be (re-)build when required.

This closes #23 issue on GitHub.
This commit is contained in:
Max Romanov
2017-12-01 16:57:30 +03:00
parent ffb1c68609
commit 40eb1f8b9b
9 changed files with 53 additions and 108 deletions

View File

@@ -0,0 +1,13 @@
// +build darwin
/*
* Copyright (C) Max Romanov
* Copyright (C) NGINX, Inc.
*/
package unit
/*
#cgo CFLAGS: -mmacosx-version-min=10.5
*/
import "C"

13
src/go/unit/linux-lrt.go Normal file
View File

@@ -0,0 +1,13 @@
// +build linux
/*
* Copyright (C) Max Romanov
* Copyright (C) NGINX, Inc.
*/
package unit
/*
#cgo LDFLAGS: -lrt
*/
import "C"

View File

@@ -4,8 +4,6 @@
* Copyright (C) NGINX, Inc.
*/
#ifndef NXT_CONFIGURE
#include <stdint.h>
#include <sys/types.h>
@@ -62,5 +60,3 @@ nxt_go_array_add(nxt_array_t *array)
return p;
}
#endif /* NXT_CONFIGURE */

View File

@@ -4,62 +4,13 @@
* Copyright (C) NGINX, Inc.
*/
#ifdef NXT_CONFIGURE
#include <stdio.h>
#include "nxt_go_lib.h"
// Stubs to compile during configure process.
int
nxt_go_response_write(nxt_go_request_t r, void *buf, size_t len)
{
return -1;
}
int
nxt_go_request_read(nxt_go_request_t r, void *dst, size_t dst_len)
{
return -1;
}
int
nxt_go_request_read_from(nxt_go_request_t r, void *dst, size_t dst_len,
void *src, size_t src_len)
{
return -1;
}
int
nxt_go_request_close(nxt_go_request_t r)
{
return -1;
}
int
nxt_go_request_done(nxt_go_request_t r)
{
return -1;
}
void
nxt_go_ready()
{
}
nxt_go_request_t
nxt_go_process_port_msg(void *buf, size_t buf_len, void *oob, size_t oob_len)
{
return 0;
}
#else
#include "nxt_go_run_ctx.h"
#include "nxt_go_log.h"
#include "nxt_go_port.h"
#include "_cgo_export.h"
#include <nxt_main.h>
#include <nxt_go_gen.h>
int
nxt_go_response_write(nxt_go_request_t r, void *buf, size_t len)
@@ -190,6 +141,3 @@ nxt_go_process_port_msg(void *buf, size_t buf_len, void *oob, size_t oob_len)
{
return nxt_go_port_on_read(buf, buf_len, oob, oob_len);
}
#endif /* NXT_CONFIGURE */

View File

@@ -4,16 +4,14 @@
* Copyright (C) NGINX, Inc.
*/
#ifndef NXT_CONFIGURE
#include "nxt_go_port.h"
#include "nxt_go_log.h"
#include "nxt_go_process.h"
#include "nxt_go_run_ctx.h"
#include "_cgo_export.h"
#include <nxt_main.h>
#include <nxt_go_gen.h>
#define nxt_go_str(p) ((nxt_go_str_t *)(p))
@@ -205,6 +203,3 @@ fail:
return 0;
}
#endif /* NXT_CONFIGURE */

View File

@@ -4,15 +4,13 @@
* Copyright (C) NGINX, Inc.
*/
#ifndef NXT_CONFIGURE
#include "nxt_go_port_memory.h"
#include "nxt_go_process.h"
#include "nxt_go_array.h"
#include "nxt_go_log.h"
#include <nxt_go_gen.h>
#include "_cgo_export.h"
#include <nxt_main.h>
#if (NXT_HAVE_MEMFD_CREATE)
@@ -197,6 +195,3 @@ unlock_return:
return hdr;
}
#endif /* NXT_CONFIGURE */

View File

@@ -4,9 +4,6 @@
* Copyright (C) NGINX, Inc.
*/
#ifndef NXT_CONFIGURE
#include "nxt_go_process.h"
#include "nxt_go_array.h"
#include "nxt_go_mutex.h"
@@ -149,6 +146,3 @@ fail:
nxt_go_mutex_unlock(&process->incoming_mutex);
}
#endif /* NXT_CONFIGURE */

View File

@@ -4,9 +4,6 @@
* Copyright (C) NGINX, Inc.
*/
#ifndef NXT_CONFIGURE
#include "nxt_go_run_ctx.h"
#include "nxt_go_log.h"
#include "nxt_go_process.h"
@@ -14,9 +11,10 @@
#include "nxt_go_mutex.h"
#include "nxt_go_port_memory.h"
#include "_cgo_export.h"
#include <nxt_port_memory_int.h>
#include <nxt_main.h>
#include <nxt_go_gen.h>
static nxt_int_t
@@ -530,6 +528,3 @@ nxt_go_ctx_read_raw(nxt_go_run_ctx_t *ctx, void *dst, size_t size)
return res;
}
#endif /* NXT_CONFIGURE */