#41 Convert LDFLAGS to GOLDFLAGS and BUILTAGS to GOBUILDTAGS
Opened 6 months ago by eclipseo. Modified 15 days ago
eclipseo/go-rpm-macros goldflags  into  master

file modified
+2 -2
@@ -398,7 +398,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

  }
@@ -458,7 +458,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 c05a419

6 months ago

rebased onto 8eb3d78

15 days ago