unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
blob fc3c40d6917cf1c976d2f87dd1ae2c435c1b6d57 4980 bytes (raw)
name: admin/nt/dist-build/build-zips.sh 	 # note: path name is non-authoritative(*)

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
 
#!/bin/bash

## Copyright (C) 2017-2022 Free Software Foundation, Inc.

## This file is part of GNU Emacs.

## GNU Emacs is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation, either version 3 of the License, or
## (at your option) any later version.

## GNU Emacs is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
## GNU General Public License for more details.

## You should have received a copy of the GNU General Public License
## along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.


function git_up {
    echo [build] Making git worktree for Emacs $VERSION
    cd $REPO_DIR/emacs-$MAJOR_VERSION
    git pull
    git worktree add ../$BRANCH $BRANCH

    cd ../$BRANCH
    ./autogen.sh
}

function build_zip {
    echo [build] Building Emacs-$VERSION

    ## Clean the install location because we use it twice
    rm -rf $HOME/emacs-build/install/emacs-$VERSION
    mkdir --parents $HOME/emacs-build/build/emacs-$VERSION
    cd $HOME/emacs-build/build/emacs-$VERSION

    ## Do we need this or is it the default?
    export PKG_CONFIG_PATH=/mingw64/lib/pkgconfig


    ## Running configure forces a rebuild of the C core which takes
    ## time that is not always needed, so do not do it unless we have
    ## to.
    if [ ! -f Makefile ] || (($CONFIG))
    then
        echo [build] Configuring Emacs
        $REPO_DIR/$BRANCH/configure \
	    --with-json \
            --without-dbus \
            --with-native-compilation \
            --without-compress-install \
            $CACHE \
            CFLAGS="$CFLAGS" 
    fi

    make -j 20 $INSTALL_TARGET \
         prefix=$HOME/emacs-build/install/emacs-$VERSION
    cd $HOME/emacs-build/install/emacs-$VERSION
    zip -r -9 emacs-$OF_VERSION-no-deps.zip *
    mv emacs-$OF_VERSION-no-deps.zip $HOME/emacs-upload

    if [ -z $SNAPSHOT ];
    then
        DEPS_FILE=$HOME/emacs-build/deps/emacs-$MAJOR_VERSION-deps.zip
    else
        ## Pick the most recent snapshot whatever that is
        DEPS_FILE=`ls $HOME/emacs-build/deps/emacs-$MAJOR_VERSION-*-deps.zip | tail -n 1`
    fi

    echo [build] Using $DEPS_FILE
    unzip -d bin $DEPS_FILE

    zip -r -9 emacs-$OF_VERSION.zip *
    mv emacs-$OF_VERSION.zip ~/emacs-upload
}

function build_installer {
    cd $HOME/emacs-build/install/
    echo [build] Calling makensis in `pwd`
    cp $REPO_DIR/$BRANCH/admin/nt/dist-build/emacs.nsi .

    makensis -v4 \
             -DEMACS_VERSION=$ACTUAL_VERSION \
             -DVERSION_BRANCH=$VERSION \
             -DOUT_VERSION=$OF_VERSION emacs.nsi
    rm emacs.nsi
    mv emacs-$OF_VERSION-installer.exe ~/emacs-upload
}

set -o errexit

SNAPSHOT=
CACHE=

BUILD=1
BUILD_64=1
GIT_UP=0
CONFIG=1
CFLAGS="-O2"
INSTALL_TARGET="install-strip"

## The location of the git repo
REPO_DIR=$HOME/emacs-build/git/


while getopts "gb:hnsiV:" opt; do
  case $opt in
    g)
        BUILD_32=0
        BUILD_64=0
        GIT_UP=1
        ;;
    n)
        CONFIG=0
        ;;
    i)
        BUILD=0
        ;;
    b)
        REQUIRED_BRANCH=$OPTARG
        echo "Setting Required branch $REQUIRED_BRANCH"
        ;;
    V)
        VERSION=$OPTARG
        ;;
    s)
        SNAPSHOT="-snapshot"
        CFLAGS="-O2 -g3"
        INSTALL_TARGET="install"
        ;;
    h)
        echo "build-zips.sh"
        echo "  -b args -- build args branch"
        echo "  -g git update and worktree only"
        echo "  -i build installer only"
        echo "  -n do not configure"
        echo "  -s snapshot build"
        exit 0
        ;;
    \?)
        echo "Invalid option: -$OPTARG" >&2
        ;;
  esac
done


## ACTUAL_VERSION is the version declared by emacs
if [ -z $ACTUAL_VERSION ];
then
    ACTUAL_VERSION=`
  sed -n 's/^AC_INIT(GNU Emacs,[	 ]*\([^	 ,)]*\).*/\1/p' < ../../../configure.ac
`
fi

if [ -z $ACTUAL_VERSION ];
then
    echo [build] Cannot determine Emacs version
    exit 1
fi

## VERSION is the version that we want to call Emacs
VERSION=$ACTUAL_VERSION


MAJOR_VERSION="$(echo $VERSION | cut -d'.' -f1)"


## VERSION includes the word snapshot if necessary
VERSION=$VERSION$SNAPSHOT

## OF version includes the date if we have a snapshot
OF_VERSION=$VERSION

if [ -z $SNAPSHOT ];
then
    BRANCH=emacs-$VERSION
else
    BRANCH=master
    CACHE=-C
    OF_VERSION="$VERSION-`date +%Y-%m-%d`"
fi

echo Checking for required branch
if [ -z $REQUIRED_BRANCH ];
then
    :
else
    BRANCH=$REQUIRED_BRANCH
    echo [build] Building from Branch $BRANCH
    VERSION=$VERSION-${BRANCH/\//_}
    OF_VERSION="$VERSION-`date +%Y-%m-%d`"
    ## Use snapshot dependencies
    SNAPSHOT=1
    CFLAGS="-O2 -g3"
    INSTALL_TARGET="install"
fi

if (($GIT_UP))
then
    git_up
fi

if (($BUILD_64))
then
    if (($BUILD))
    then
        build_zip
    fi
    build_installer
fi

debug log:

solving fc3c40d691 ...
found fc3c40d691 in https://yhetil.org/emacs-devel/CAJf-WoQh93OG=rLTry-Vfw740uCX6PxDMGiwR-itiupMdqUd3g@mail.gmail.com/
found 77d20a5a7b in https://git.savannah.gnu.org/cgit/emacs.git
preparing index
index prepared:
100755 77d20a5a7b985f3af3c2c67ba98f348c5e66052c	admin/nt/dist-build/build-zips.sh

applying [1/1] https://yhetil.org/emacs-devel/CAJf-WoQh93OG=rLTry-Vfw740uCX6PxDMGiwR-itiupMdqUd3g@mail.gmail.com/
diff --git a/admin/nt/dist-build/build-zips.sh b/admin/nt/dist-build/build-zips.sh
index 77d20a5a7b..fc3c40d691 100755

1:15: trailing whitespace.
            CFLAGS="$CFLAGS" 
Checking patch admin/nt/dist-build/build-zips.sh...
Applied patch admin/nt/dist-build/build-zips.sh cleanly.
warning: 1 line adds whitespace errors.

index at:
100755 fc3c40d6917cf1c976d2f87dd1ae2c435c1b6d57	admin/nt/dist-build/build-zips.sh

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).