Use gnu for ruby build because strptime is provided by posix (#5660)

* Use gnu for ruby build because strptime is provided by posix

* Move option to extconf.rb

* Remove unused code in Rakefile

* Add config files for kokoro test

* Use gnu 11

* Define _XOPEN_SOURCE

* Add gnu11 option

* Remove XOPEN

* Try base_cc_flags

* Try config_options

* Move time.h to top

* Try -D_XOPEN_SOURCE=700

* Define XOPEN_SOURCE directly

* Try extconf.rb

* Try CFLAGS

* Try ext.cross_config_options

* Make mac ruby release job fail on error

* Try again

* Try define _XOPEN_SOURCE in extconf.rb

* Try again

* Define __USE_XOPEN

* Remove 2.6.0

* No mingw

* Throw error on mingw

* Remove XOPEN_SOURCE in upb

* Add back mingw

* Remove comment
pull/5666/head
Paul Yang 6 years ago committed by GitHub
parent 1ee15baefc
commit 7d9377e7f3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      kokoro/release/python/linux/continuous.cfg
  2. 8
      kokoro/release/python/linux/presubmit.cfg
  3. 8
      kokoro/release/python/macos/continuous.cfg
  4. 8
      kokoro/release/python/macos/presubmit.cfg
  5. 8
      kokoro/release/ruby/linux/continuous.cfg
  6. 8
      kokoro/release/ruby/linux/presubmit.cfg
  7. 2
      kokoro/release/ruby/linux/ruby/ruby_build.sh
  8. 8
      kokoro/release/ruby/macos/continuous.cfg
  9. 8
      kokoro/release/ruby/macos/presubmit.cfg
  10. 2
      kokoro/release/ruby/macos/ruby/ruby_build.sh
  11. 8
      ruby/ext/google/protobuf_c/extconf.rb
  12. 12
      ruby/ext/google/protobuf_c/upb.c

@ -0,0 +1,8 @@
# Config file for running tests in Kokoro
build_file: "protobuf/kokoro/release/python/linux/build_artifacts.sh"
action {
define_artifacts {
regex: "github/protobuf/artifacts/**"
}
}

@ -0,0 +1,8 @@
# Config file for running tests in Kokoro
build_file: "protobuf/kokoro/release/python/linux/build_artifacts.sh"
action {
define_artifacts {
regex: "github/protobuf/artifacts/**"
}
}

@ -0,0 +1,8 @@
# Configuration for Mac OSX release builds
build_file: "protobuf/kokoro/release/python/macos/build_artifacts.sh"
action {
define_artifacts {
regex: "github/protobuf/artifacts/**"
}
}

@ -0,0 +1,8 @@
# Configuration for Mac OSX release builds
build_file: "protobuf/kokoro/release/python/macos/build_artifacts.sh"
action {
define_artifacts {
regex: "github/protobuf/artifacts/**"
}
}

@ -0,0 +1,8 @@
# Configuration for Linux release builds
build_file: "protobuf/kokoro/release/ruby/linux/build_artifacts.sh"
action {
define_artifacts {
regex: "github/protobuf/artifacts/**"
}
}

@ -0,0 +1,8 @@
# Configuration for Linux release builds
build_file: "protobuf/kokoro/release/ruby/linux/build_artifacts.sh"
action {
define_artifacts {
regex: "github/protobuf/artifacts/**"
}
}

@ -1,5 +1,7 @@
#!/bin/bash #!/bin/bash
set -ex
# Build protoc # Build protoc
if test ! -e src/protoc; then if test ! -e src/protoc; then
./autogen.sh ./autogen.sh

@ -0,0 +1,8 @@
# Configuration for Mac OSX release builds
build_file: "protobuf/kokoro/release/ruby/macos/build_artifacts.sh"
action {
define_artifacts {
regex: "github/protobuf/artifacts/**"
}
}

@ -0,0 +1,8 @@
# Configuration for Mac OSX release builds
build_file: "protobuf/kokoro/release/ruby/macos/build_artifacts.sh"
action {
define_artifacts {
regex: "github/protobuf/artifacts/**"
}
}

@ -1,5 +1,7 @@
#!/bin/bash #!/bin/bash
set -ex
# Build protoc # Build protoc
if test ! -e src/protoc; then if test ! -e src/protoc; then
./autogen.sh ./autogen.sh

@ -2,7 +2,13 @@
require 'mkmf' require 'mkmf'
$CFLAGS += " -std=c99 -O3 -DNDEBUG" if RUBY_PLATFORM =~ /darwin/ || RUBY_PLATFORM =~ /linux/
# XOPEN_SOURCE needed for strptime:
# https://stackoverflow.com/questions/35234152/strptime-giving-implicit-declaration-and-undefined-reference
$CFLAGS += " -std=c99 -O3 -DNDEBUG -D_XOPEN_SOURCE=700"
else
$CFLAGS += " -std=c99 -O3 -DNDEBUG"
end
if RUBY_PLATFORM =~ /linux/ if RUBY_PLATFORM =~ /linux/

@ -12610,11 +12610,6 @@ done:
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
/* Need to define __USE_XOPEN before including time.h to make strptime work. */
#ifndef __USE_XOPEN
#define __USE_XOPEN
#endif
#include <time.h> #include <time.h>
@ -14127,12 +14122,19 @@ static bool end_timestamp_base(upb_json_parser *p, const char *ptr) {
memcpy(timestamp_buf + UPB_TIMESTAMP_BASE_SIZE, "GMT", 3); memcpy(timestamp_buf + UPB_TIMESTAMP_BASE_SIZE, "GMT", 3);
timestamp_buf[UPB_TIMESTAMP_BASE_SIZE + 3] = 0; timestamp_buf[UPB_TIMESTAMP_BASE_SIZE + 3] = 0;
#if defined __MINGW32__ || defined __MINGW64__
upb_status_seterrf(
&p->status, "error parsing timestamp: mingw doesn't support strptime");
upb_env_reporterror(p->env, &p->status);
return false;
#else
/* Parse seconds */ /* Parse seconds */
if (strptime(timestamp_buf, "%FT%H:%M:%S%Z", &p->tm) == NULL) { if (strptime(timestamp_buf, "%FT%H:%M:%S%Z", &p->tm) == NULL) {
upb_status_seterrf(&p->status, "error parsing timestamp: %s", buf); upb_status_seterrf(&p->status, "error parsing timestamp: %s", buf);
upb_env_reporterror(p->env, &p->status); upb_env_reporterror(p->env, &p->status);
return false; return false;
} }
#endif
/* Clean up buffer */ /* Clean up buffer */
multipart_end(p); multipart_end(p);

Loading…
Cancel
Save