#41 Convert LDFLAGS to GOLDFLAGS and BUILTAGS to GOBUILDTAGS
Closed a month ago by ngompa. Opened 2 years ago by eclipseo.
eclipseo/go-rpm-macros goldflags  into  master

file modified
+2 -2
@@ -392,7 +392,7 @@ 

               GOPATH="${workroot}${GOPATH:+:${GOPATH}}:${gopath}" \

                 PATH="${workbin:+${workbin}:}${PATH}" \

          GO111MODULE=off \

-           go test ${GO_TEST_FLAGS} -ldflags "${LDFLAGS:+${LDFLAGS} }-extldflags '${GO_TEST_EXT_LD_FLAGS}'"

+           go test ${GO_TEST_FLAGS} -ldflags "${GOLDFLAGS:+${GOLDFLAGS} }-extldflags '${GO_TEST_EXT_LD_FLAGS}'"

        popd >/dev/null

      done

  }
@@ -452,7 +452,7 @@ 

                    echo "         PATH: ${workbin:+${workbin}:}${PATH}"

                    echo "       GOPATH: ${workroot}${GOPATH:+:${GOPATH}}:${gopath}"

                    echo "  GO111MODULE: off"

-                   echo "      command: go test ${GO_TEST_FLAGS} -ldflags \"${LDFLAGS:+${LDFLAGS} }-extldflags '${GO_TEST_EXT_LD_FLAGS}'\""

+                   echo "      command: go test ${GO_TEST_FLAGS} -ldflags \"${GOLDFLAGS:+${GOLDFLAGS} }-extldflags '${GO_TEST_EXT_LD_FLAGS}'\""

                    echo "      testing: ${goipath}"

                    checks "${goipath}" ;;

    provides)       while read lockfile ; do

@@ -29,7 +29,7 @@ 

  #

  #    %make GOBUILDFLAGS="%gobuildflags"

  #

- %gobuildflags() %{expand:%{gocompilerflags} -tags="rpm_crashtraceback ${BUILDTAGS:-}" -ldflags "${LDFLAGS:-} %{?currentgoldflags} -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \\n') -compressdwarf=false -linkmode=external -extldflags '%{build_ldflags} %{?__golang_extldflags}'" -a -v -x}

+ %gobuildflags() %{expand:%{gocompilerflags} -tags="rpm_crashtraceback ${GOBUILDTAGS:-}" -ldflags "${GOLDFLAGS:-} %{?currentgoldflags} -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \\n') -compressdwarf=false -linkmode=external -extldflags '%__global_ldflags %{?__golang_extldflags}'" -a -v -x}

  

  # Turn off Go modules

  %gomodulesmode GO111MODULE=off
@@ -37,10 +37,6 @@ 

  # Define commands for building

  # BUILD_ID can be generated for golang build no matter of debuginfo

  %gobuild(o:) %{expand:

-   # https://pagure.io/go-rpm-macros/pull-request/38

-   # Most of the default LDFLAGS for Fedora are not supported so we don't want

-   # LDFLAGS to be automatically initialized with the Fedora flags.

-   %undefine _auto_set_build_flags

    # https://bugzilla.redhat.com/show_bug.cgi?id=995136#c12

    %global _dwz_low_mem_die_limit 0

    %{?gobuilddir:GOPATH="%{gobuilddir}:${GOPATH:+${GOPATH}:}%{?gopath}"} %{?gomodulesmode} \\
@@ -52,6 +48,5 @@ 

  %gotestflags      %{gocompilerflags}

  %gotestextldflags %{build_ldflags} %{?__golang_extldflags}

  %gotest() %{expand:

-   %undefine _auto_set_build_flags

-   %{?gomodulesmode} go test %{gotestflags} -ldflags "${LDFLAGS:-} %{?currentgoldflags} -extldflags '%{gotestextldflags}'" %{?**};

+   %{?gomodulesmode} go test %{gotestflags} -ldflags "${GOLDFLAGS:-} %{?currentgoldflags} -extldflags '%{gotestextldflags}'" %{?**};

  }

file modified
+1 -1
@@ -351,7 +351,7 @@ 

          zsuffix = "-z " .. suffix .. " "

    end

    print(rpm.expand('%goenv ' .. zsuffix        .. myenvflags   .. '\\n'               ..

-                    '%{?currentgoldflags:LDFLAGS="${LDFLAGS} %{?currentgoldflags}" }'   ..

+                    '%{?currentgoldflags:GOLDFLAGS="${GOLDFLAGS} %{?currentgoldflags}" }'   ..

                     '%{?gotestflags:GO_TEST_FLAGS="%{gotestflags}" }'                  ..

                     '%{?gotestextldflags:GO_TEST_EXT_LD_FLAGS="%{gotestextldflags}" }' ..

                     'go-rpm-integration check ' .. mycheckflags .. '\\n'))

WIP

Needs change in packages.

rebased onto c05a41948e84067e90cf8e8956565cd2c1bbd716

2 years ago

rebased onto 8eb3d78

2 years ago

rebased onto 43d7456

2 years ago

rebased onto b9f763b

2 months ago

Pull-Request has been closed by ngompa

a month ago