removed the cfg package from go code.
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
instead, started using -ldflags "-X var=val" to set constant values
This commit is contained in:
parent
ca9a6b9eb7
commit
a02c323393
@ -45,14 +45,12 @@ hclgo_LINK = cp -pf hclgo.bin hclgo$(EXEEXT) || echo "FAILED TO LINK"
|
||||
hclgo.bin: lib/libhcl.la $(hclgo_OBJECTS)
|
||||
cp -pf $(srcdir)/go.mod $(builddir)/go.mod >/dev/null 2>&1 || true
|
||||
chmod u+w $(builddir)/go.mod ## with `make distcheck`, the echo's redirection to the file fails without this permission change
|
||||
sed -r -i -e "/^[[:space:]]*replace[[:space:]]+cfg[[:space:]]*=>/d" $(builddir)/go.mod
|
||||
echo -e "\nreplace cfg => $(abs_builddir)/go/cfg" >> $(builddir)/go.mod
|
||||
[ -f $(srcdir)/go.sum ] && cp -pf $(srcdir)/go.sum $(builddir)/go.sum >/dev/null 2>&1 || true
|
||||
## ---------------------------------------------------------------
|
||||
CC=$(CC) \
|
||||
CGO_CFLAGS="-I$(abs_srcdir)/lib -I$(abs_builddir)/lib $(CFLAGS)" \
|
||||
CGO_LDFLAGS="-L$(abs_builddir)/lib -L$(abs_builddir)/lib/.libs -lhcl -ldl -lquadmath" \
|
||||
go build -C $(srcdir) -x -o $(abs_builddir)/hclgo.bin -modfile $(abs_builddir)/go.mod
|
||||
go build -C $(srcdir) -ldflags "-X 'main.BINDIR=$(bindir)' -X 'main.SBINDIR=$(sbindir)' -X 'main.LIBDIR=$(libdir)' -X 'main.SYSCONFDIR=$(sysconfdir)'" -x -o $(abs_builddir)/hclgo.bin -modfile $(abs_builddir)/go.mod
|
||||
## ---------------------------------------------------------------
|
||||
go clean -C $(srcdir) -x -modfile $(abs_builddir)/go.mod
|
||||
rm -rf $(builddir)/go.mod $(builddir)/go.sum
|
||||
|
17
Makefile.in
17
Makefile.in
@ -106,7 +106,7 @@ am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
|
||||
configure.lineno config.status.lineno
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
CONFIG_HEADER = $(top_builddir)/lib/hcl-cfg.h
|
||||
CONFIG_CLEAN_FILES = go/cfg/go.mod go/cfg/cfg.go
|
||||
CONFIG_CLEAN_FILES =
|
||||
CONFIG_CLEAN_VPATH_FILES =
|
||||
am__installdirs = "$(DESTDIR)$(bindir)"
|
||||
PROGRAMS = $(bin_PROGRAMS)
|
||||
@ -173,10 +173,9 @@ am__define_uniq_tagged_files = \
|
||||
am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/ac/ar-lib \
|
||||
$(top_srcdir)/ac/compile $(top_srcdir)/ac/config.guess \
|
||||
$(top_srcdir)/ac/config.sub $(top_srcdir)/ac/install-sh \
|
||||
$(top_srcdir)/ac/ltmain.sh $(top_srcdir)/ac/missing \
|
||||
$(top_srcdir)/go/cfg/cfg.go.in $(top_srcdir)/go/cfg/go.mod.in \
|
||||
README.md ac/ar-lib ac/compile ac/config.guess ac/config.sub \
|
||||
ac/depcomp ac/install-sh ac/ltmain.sh ac/missing
|
||||
$(top_srcdir)/ac/ltmain.sh $(top_srcdir)/ac/missing README.md \
|
||||
ac/ar-lib ac/compile ac/config.guess ac/config.sub ac/depcomp \
|
||||
ac/install-sh ac/ltmain.sh ac/missing
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
distdir = $(PACKAGE)-$(VERSION)
|
||||
top_distdir = $(distdir)
|
||||
@ -410,10 +409,6 @@ $(top_srcdir)/configure: $(am__configure_deps)
|
||||
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
|
||||
$(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
|
||||
$(am__aclocal_m4_deps):
|
||||
go/cfg/go.mod: $(top_builddir)/config.status $(top_srcdir)/go/cfg/go.mod.in
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $@
|
||||
go/cfg/cfg.go: $(top_builddir)/config.status $(top_srcdir)/go/cfg/cfg.go.in
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $@
|
||||
install-binPROGRAMS: $(bin_PROGRAMS)
|
||||
@$(NORMAL_INSTALL)
|
||||
@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
|
||||
@ -940,13 +935,11 @@ clean-local:
|
||||
@ENABLE_HCLGO_TRUE@hclgo.bin: lib/libhcl.la $(hclgo_OBJECTS)
|
||||
@ENABLE_HCLGO_TRUE@ cp -pf $(srcdir)/go.mod $(builddir)/go.mod >/dev/null 2>&1 || true
|
||||
@ENABLE_HCLGO_TRUE@ chmod u+w $(builddir)/go.mod ## with `make distcheck`, the echo's redirection to the file fails without this permission change
|
||||
@ENABLE_HCLGO_TRUE@ sed -r -i -e "/^[[:space:]]*replace[[:space:]]+cfg[[:space:]]*=>/d" $(builddir)/go.mod
|
||||
@ENABLE_HCLGO_TRUE@ echo -e "\nreplace cfg => $(abs_builddir)/go/cfg" >> $(builddir)/go.mod
|
||||
@ENABLE_HCLGO_TRUE@ [ -f $(srcdir)/go.sum ] && cp -pf $(srcdir)/go.sum $(builddir)/go.sum >/dev/null 2>&1 || true
|
||||
@ENABLE_HCLGO_TRUE@ CC=$(CC) \
|
||||
@ENABLE_HCLGO_TRUE@ CGO_CFLAGS="-I$(abs_srcdir)/lib -I$(abs_builddir)/lib $(CFLAGS)" \
|
||||
@ENABLE_HCLGO_TRUE@ CGO_LDFLAGS="-L$(abs_builddir)/lib -L$(abs_builddir)/lib/.libs -lhcl -ldl -lquadmath" \
|
||||
@ENABLE_HCLGO_TRUE@ go build -C $(srcdir) -x -o $(abs_builddir)/hclgo.bin -modfile $(abs_builddir)/go.mod
|
||||
@ENABLE_HCLGO_TRUE@ go build -C $(srcdir) -ldflags "-X 'main.BINDIR=$(bindir)' -X 'main.SBINDIR=$(sbindir)' -X 'main.LIBDIR=$(libdir)' -X 'main.SYSCONFDIR=$(sysconfdir)'" -x -o $(abs_builddir)/hclgo.bin -modfile $(abs_builddir)/go.mod
|
||||
@ENABLE_HCLGO_TRUE@ go clean -C $(srcdir) -x -modfile $(abs_builddir)/go.mod
|
||||
@ENABLE_HCLGO_TRUE@ rm -rf $(builddir)/go.mod $(builddir)/go.sum
|
||||
|
||||
|
4
configure
vendored
4
configure
vendored
@ -18740,7 +18740,7 @@ printf "%s\n" "#define HCL_CONFIGURE_ARGS \"$ac_configure_args\"" >>confdefs.h
|
||||
printf "%s\n" "#define HCL_CONFIGURE_CMD \"$hcl_configure_cmd\"" >>confdefs.h
|
||||
|
||||
|
||||
ac_config_files="$ac_config_files Makefile lib/Makefile mod/Makefile bin/Makefile go/cfg/go.mod go/cfg/cfg.go t/Makefile"
|
||||
ac_config_files="$ac_config_files Makefile lib/Makefile mod/Makefile bin/Makefile t/Makefile"
|
||||
|
||||
cat >confcache <<\_ACEOF
|
||||
# This file is a shell script that caches the results of configure
|
||||
@ -19792,8 +19792,6 @@ do
|
||||
"lib/Makefile") CONFIG_FILES="$CONFIG_FILES lib/Makefile" ;;
|
||||
"mod/Makefile") CONFIG_FILES="$CONFIG_FILES mod/Makefile" ;;
|
||||
"bin/Makefile") CONFIG_FILES="$CONFIG_FILES bin/Makefile" ;;
|
||||
"go/cfg/go.mod") CONFIG_FILES="$CONFIG_FILES go/cfg/go.mod" ;;
|
||||
"go/cfg/cfg.go") CONFIG_FILES="$CONFIG_FILES go/cfg/cfg.go" ;;
|
||||
"t/Makefile") CONFIG_FILES="$CONFIG_FILES t/Makefile" ;;
|
||||
|
||||
*) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
|
||||
|
@ -690,8 +690,6 @@ AC_CONFIG_FILES([
|
||||
lib/Makefile
|
||||
mod/Makefile
|
||||
bin/Makefile
|
||||
go/cfg/go.mod
|
||||
go/cfg/cfg.go
|
||||
t/Makefile
|
||||
])
|
||||
AC_OUTPUT
|
||||
|
@ -1,5 +0,0 @@
|
||||
package cfg
|
||||
|
||||
|
||||
|
||||
const BINDIR string = "@bindir@"
|
@ -1,6 +0,0 @@
|
||||
module cfg
|
||||
|
||||
go 1.20
|
||||
|
||||
// this package is not supposed to be used by other parties.
|
||||
// it's intended for internal use only to work around buld issues with autotools.
|
7
main.go
7
main.go
@ -1,7 +1,6 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
_ "cfg"
|
||||
"fmt"
|
||||
"os"
|
||||
"strings"
|
||||
@ -19,6 +18,12 @@ import (
|
||||
`))
|
||||
*/
|
||||
|
||||
/* to be set in build time */
|
||||
var BINDIR = "."
|
||||
var SBINDIR = "."
|
||||
var LIBDIR = "."
|
||||
var SYSCONFDIR = "."
|
||||
|
||||
type Param struct {
|
||||
log_file string
|
||||
input_file string
|
||||
|
@ -478,7 +478,7 @@ check_SCRIPTS = \
|
||||
ret-01.hcl \
|
||||
retvar-01.hcl \
|
||||
va-01.hcl \
|
||||
var-01.hcl
|
||||
var-02.hcl
|
||||
|
||||
check_ERRORS = \
|
||||
call-01.err \
|
||||
|
Loading…
Reference in New Issue
Block a user