Skip to content

Commit

Permalink
rework 'version.tmp' (ghdl#1320)
Browse files Browse the repository at this point in the history
* msys2: work around makepkg hanging at the end of build()

* ci: update actions/checkout to v2

* make: allow setting default description through GHDL_DESC

* ci: ensure clean git describe on MSYS2
  • Loading branch information
umarcor authored May 20, 2020
1 parent 42cbe91 commit 0e39a57
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 27 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/doc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ jobs:
linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2
- name: build doc
run: ./doc/make.sh
10 changes: 6 additions & 4 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
gpl:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2
- run: |
TASK=buster+mcode ./dist/ci-run.sh -c --gpl --no-synth
Expand All @@ -22,14 +22,14 @@ jobs:
task: [ mcode, llvm-7, gcc-8.3.0 ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2
- run: |
TASK=buster+${{ matrix.task }} ./dist/ci-run.sh -c
osx:
runs-on: macOS-latest
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2
- run: |
brew update
brew install p7zip
Expand Down Expand Up @@ -61,7 +61,9 @@ jobs:
with:
msystem: MSYS
update: true
- uses: actions/checkout@v1
install: base-devel git
- run: git config --global core.autocrlf input
- uses: actions/checkout@v2
- name: Build and (hopefully) install package
shell: msys2 {0}
run: |
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ testsuite/get_entities

# Generated files on windows.
/build/
/dist/msys2-mingw/**/logpipe.*
/dist/msys2-mingw/**/*.log

# Generated directories on Linux
lib/
Expand Down
12 changes: 4 additions & 8 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ CP=cp
MV=mv
SED=sed
GRT_RANLIB=ranlib
GHDL_DESC?=tarball

VHDL_LIB_DIR=$(prefix)/$(libdirsuffix)

Expand Down Expand Up @@ -162,14 +163,9 @@ GRTSRCDIR=$(abs_srcdir)/src/grt
include $(srcdir)/src/grt/Makefile.inc

version.tmp: $(srcdir)/src/version.in force
# Create version.tmp from version.in, using git date/hash
if test -d $(srcdir)/.git \
&& desc=`cd $(srcdir); git describe --dirty`; then \
sub="s/[(].*[)]/($$desc)/"; \
else \
sub="s/tarball/tarball/"; \
fi; \
$(SED) -e "$$sub" -e "s/@VER@/$(ghdl_version)/" < $< > $@; \
# Create version.tmp from version.in, using git date/hash, or envvar GHDL_DESC. Defaults to 'tarball'.
if test -d $(srcdir)/.git && desc=`cd $(srcdir); git describe --dirty`; then GHDL_DESC="$$desc"; fi; \
$(SED) -e "s/[(].*[)]/($$GHDL_DESC)/" -e "s/@VER@/$(ghdl_version)/" < $< > $@; \

version.ads: version.tmp
# Change version.ads only if version.tmp has been modified to avoid
Expand Down
11 changes: 1 addition & 10 deletions dist/ci-run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -402,21 +402,12 @@ ci_run () {
else
# Assume linux

gstart "[CI] Build version.tmp and replace version.in with it (so that the version is correctly set)" "$ANSI_BLUE"
# This is a little bit hack-ish, as it assumes that 'git' is not
# available in docker (otherwise it will describe as -dirty
# because this modifies the source file version.in).
ghdl_version_line=`grep -e '^ghdl_version' configure`
make -f Makefile.in srcdir=. $ghdl_version_line version.tmp
cp version.tmp src/version.in
gend

gstart "[CI] Docker pull ghdl/build:$BUILD_IMAGE_TAG" "$ANSI_BLUE"
docker pull ghdl/build:$BUILD_IMAGE_TAG
gend

printf "$ANSI_BLUE[CI] Build ghdl in docker image ghdl/build:$BUILD_IMAGE_TAG\n"
$RUN -e CONFIG_OPTS="$CONFIG_OPTS" "ghdl/build:$BUILD_IMAGE_TAG" bash -c "${scriptdir}/ci-run.sh $BUILD_CMD_OPTS build"
$RUN -e GHDL_DESC="$(git describe --dirty)@${BUILD_IMAGE_TAG}" -e CONFIG_OPTS="$CONFIG_OPTS" "ghdl/build:$BUILD_IMAGE_TAG" bash -c "${scriptdir}/ci-run.sh $BUILD_CMD_OPTS build"
fi

if [ ! -f build_ok ]; then
Expand Down
1 change: 1 addition & 0 deletions dist/msys2-mingw/llvm/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ build() {
cd "${srcdir}/builddir"
../../../../../configure --prefix=${MINGW_PREFIX} --with-llvm-config="llvm-config --link-static" LDFLAGS="-static" --enable-libghdl --enable-synth
make GNATMAKE="gnatmake -j$(nproc)"
exit
}

package() {
Expand Down
1 change: 1 addition & 0 deletions dist/msys2-mingw/mcode/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ build() {
cd "${srcdir}/builddir"
../../../../../configure --prefix=${MINGW_PREFIX} LDFLAGS=-static --enable-libghdl --enable-synth
make GNATMAKE="gnatmake -j$(nproc)"
exit
}

package() {
Expand Down
15 changes: 11 additions & 4 deletions dist/msys2-mingw/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ cd $(dirname $0)

build () {
gstart 'Install common build dependencies'
pacman -S --noconfirm base-devel git
pacman -S --noconfirm base-devel
gend

if [ -z "$TARGET" ]; then
Expand All @@ -67,6 +67,12 @@ build () {
fi
cd "$TARGET"

gstart "Fetch --unshallow"
# The command 'git describe' (used for version) needs the history. Get it.
# But the following command fails if the repository is complete.
git fetch --unshallow || true
gend

MINGW_INSTALLS="$(echo "$MINGW_INSTALLS" | tr '[:upper:]' '[:lower:]')"

case "$MINGW_INSTALLS" in
Expand All @@ -92,11 +98,12 @@ build () {
gend

gstart 'Build package'
dos2unix PKGBUILD
makepkg-mingw -sCLfc --noconfirm --noprogressbar
makepkg-mingw --noconfirm --noprogressbar -sCLf --noarchive
gend

ls -la
gstart 'Archive package'
makepkg-mingw --noconfirm --noprogressbar -R
gend

gstart 'Install package'
pacman --noconfirm -U "mingw-w64-${TARBALL_ARCH}-ghdl-${TARGET}-ci"-*-any.pkg.tar.zst
Expand Down

0 comments on commit 0e39a57

Please sign in to comment.