aboutsummaryrefslogtreecommitdiff
path: root/src/util/sha1.h
blob: c04947373e012ca417cbe8ffdf8f9ea566c93484 (plain)
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
/* sha1.h

Copyright (c) 2005 Michael D. Leonhard

http://tamale.net/

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

*/

#ifndef SHA1_HEADER
typedef unsigned int Uint32;

class SHA1
{
	private:
		// fields
		Uint32 H0, H1, H2, H3, H4;
		unsigned char bytes[64];
		int unprocessedBytes;
		Uint32 size;
		void process();
	public:
		SHA1();
		~SHA1();
		void addBytes( const char* data, int num );
		unsigned char* getDigest();
		// utility methods
		static Uint32 lrot( Uint32 x, int bits );
		static void storeBigEndianUint32( unsigned char* byte, Uint32 num );
		static void hexPrinter( unsigned char* c, int l );
};

#define SHA1_HEADER
#endif
f='#n195'>195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287
---
# Github repository is cloned every day on Gitlab.com
# https://gitlab.com/minetest/minetest
# Pipelines URL: https://gitlab.com/minetest/minetest/pipelines

stages:
  - build
  - package
  - deploy

variables:
  IRRLICHT_TAG: "1.9.0mt4"
  MINETEST_GAME_REPO: "https://github.com/minetest/minetest_game.git"
  CONTAINER_IMAGE: registry.gitlab.com/$CI_PROJECT_PATH

.build_template:
  stage: build
  before_script:
   - apt-get update
   - DEBIAN_FRONTEND=noninteractive apt-get -y install build-essential git cmake libpng-dev libjpeg-dev libxxf86vm-dev libgl1-mesa-dev libsqlite3-dev libleveldb-dev libogg-dev libvorbis-dev libopenal-dev libcurl4-gnutls-dev libfreetype6-dev zlib1g-dev libgmp-dev libjsoncpp-dev libzstd-dev
  script:
    - git clone https://github.com/minetest/irrlicht -b $IRRLICHT_TAG lib/irrlichtmt
    - make -j$(($(nproc) + 1))
  artifacts:
    when: on_success
    expire_in: 1h
    paths:
      - artifact/*

.debpkg_template:
  stage: package
  before_script:
    - apt-get update
    - apt-get install -y git
    - mkdir -p build/deb/minetest/DEBIAN/
    - cp misc/debpkg-control build/deb/minetest/DEBIAN/control
    - cp -a artifact/minetest/usr build/deb/minetest/
  script:
    - git clone $MINETEST_GAME_REPO build/deb/minetest/usr/share/minetest/games/minetest_game
    - rm -rf build/deb/minetest/usr/share/minetest/games/minetest/.git
    - sed -i 's/DATEPLACEHOLDER/'$(date +%y.%m.%d)'/g' build/deb/minetest/DEBIAN/control
    - sed -i 's/JPEG_PLACEHOLDER/'$JPEG_PKG'/g' build/deb/minetest/DEBIAN/control
    - sed -i 's/LEVELDB_PLACEHOLDER/'$LEVELDB_PKG'/g' build/deb/minetest/DEBIAN/control
    - sed -i 's/JSONCPP_PLACEHOLDER/'$JSONCPP_PKG'/g' build/deb/minetest/DEBIAN/control
    - cd build/deb/ && dpkg-deb -b minetest/ && mv minetest.deb ../../
  artifacts:
    expire_in: 90 day
    paths:
      - ./*.deb

.debpkg_install:
  stage: deploy
  before_script:
    - apt-get update -qy
  script:
    - apt-get install -y ./*.deb
    - minetest --version

##
## Debian
##

# Stretch

build:debian-9:
 extends: .build_template
 image: debian:9

package:debian-9:
  extends: .debpkg_template
  image: debian:9
  needs:
    - build:debian-9
  variables:
    JSONCPP_PKG: libjsoncpp1
    LEVELDB_PKG: libleveldb1v5
    JPEG_PKG: libjpeg62-turbo

deploy:debian-9:
  extends: .debpkg_install
  image: debian:9
  needs:
    - package:debian-9

# Buster

build:debian-10:
 extends: .build_template
 image: debian:10

package:debian-10:
  extends: .debpkg_template
  image: debian:10
  needs:
    - build:debian-10
  variables:
    JSONCPP_PKG: libjsoncpp1
    LEVELDB_PKG: libleveldb1d
    JPEG_PKG: libjpeg62-turbo

deploy:debian-10:
  extends: .debpkg_install
  image: debian:10
  needs:
    - package:debian-10

# Bullseye

build:debian-11:
 extends: .build_template
 image: debian:11

package:debian-11:
  extends: .debpkg_template
  image: debian:11
  needs:
    - build:debian-11
  variables:
    JSONCPP_PKG: libjsoncpp24
    LEVELDB_PKG: libleveldb1d
    JPEG_PKG: libjpeg62-turbo

deploy:debian-11:
  extends: .debpkg_install
  image: debian:11
  needs:
    - package:debian-11

##
## Ubuntu
##

# Bionic

build:ubuntu-18.04:
  extends: .build_template
  image: ubuntu:bionic

package:ubuntu-18.04:
  extends: .debpkg_template
  image: ubuntu:bionic
  needs:
    - build:ubuntu-18.04
  variables:
    JSONCPP_PKG: libjsoncpp1
    LEVELDB_PKG: libleveldb1v5
    JPEG_PKG: libjpeg-turbo8

deploy:ubuntu-18.04:
  extends: .debpkg_install
  image: ubuntu:bionic
  needs:
    - package:ubuntu-18.04

# Focal

build:ubuntu-20.04:
  extends: .build_template
  image: ubuntu:focal

package:ubuntu-20.04:
  extends: .debpkg_template
  image: ubuntu:focal
  needs:
    - build:ubuntu-20.04
  variables:
    JSONCPP_PKG: libjsoncpp1
    LEVELDB_PKG: libleveldb1d
    JPEG_PKG: libjpeg-turbo8

deploy:ubuntu-20.04:
  extends: .debpkg_install
  image: ubuntu:focal
  needs:
    - package:ubuntu-20.04

##
## Fedora
##

# Fedora 28 <-> RHEL 8
build:fedora-28:
  extends: .build_template
  image: fedora:28
  before_script:
    - dnf -y install make git gcc gcc-c++ kernel-devel cmake libjpeg-devel libpng-devel libcurl-devel openal-soft-devel libvorbis-devel libXxf86vm-devel libogg-devel freetype-devel mesa-libGL-devel zlib-devel jsoncpp-devel gmp-devel sqlite-devel luajit-devel leveldb-devel ncurses-devel spatialindex-devel libzstd-devel

##
## MinGW for Windows
##

.generic_win_template:
  image: ubuntu:focal
  before_script:
    - apt-get update
    - DEBIAN_FRONTEND=noninteractive apt-get install -y wget xz-utils unzip git cmake gettext
    - wget -nv http://minetest.kitsunemimi.pw/mingw-w64-${WIN_ARCH}_11.2.0_ubuntu20.04.tar.xz -O mingw.tar.xz
    - tar -xaf mingw.tar.xz -C /usr

.build_win_template:
  extends: .generic_win_template
  stage: build
  artifacts:
    expire_in: 90 day
    paths:
      - minetest-*-win*/*

build:win32:
  extends: .build_win_template
  script:
    - EXISTING_MINETEST_DIR=$PWD ./util/buildbot/buildwin32.sh build
    - unzip -q build/build/*.zip
  variables:
    WIN_ARCH: "i686"

build:win64:
  extends: .build_win_template
  script:
    - EXISTING_MINETEST_DIR=$PWD ./util/buildbot/buildwin64.sh build
    - unzip -q build/build/*.zip
  variables:
    WIN_ARCH: "x86_64"

##
## Docker
##

package:docker:
  stage: package
  image: docker:stable
  services:
    - docker:dind
  before_script:
    - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN registry.gitlab.com
  script:
    - docker build . -t ${CONTAINER_IMAGE}/server:$CI_COMMIT_SHA -t ${CONTAINER_IMAGE}/server:$CI_COMMIT_REF_NAME -t ${CONTAINER_IMAGE}/server:latest
    - docker push ${CONTAINER_IMAGE}/server:$CI_COMMIT_SHA
    - docker push ${CONTAINER_IMAGE}/server:$CI_COMMIT_REF_NAME
    - docker push ${CONTAINER_IMAGE}/server:latest

##
## Gitlab Pages (Lua API documentation)
##

pages:
  stage: deploy
  image: python:3.8
  before_script:
    - pip install git+https://github.com/Python-Markdown/markdown.git
    - pip install git+https://github.com/mkdocs/mkdocs.git
    - pip install pygments
  script:
    - cd doc/mkdocs && ./build.sh
  artifacts:
    paths:
      - public
  only:
    - master

##
## AppImage
##

package:appimage-client:
  stage: package
  image: appimagecrafters/appimage-builder
  needs:
    - build:ubuntu-18.04
  before_script:
    - apt-get update -y
    - apt-get install -y git
    # Collect files
    - mkdir AppDir
    - cp -a artifact/minetest/usr/ AppDir/usr/
    - rm AppDir/usr/bin/minetestserver
    - cp -a clientmods AppDir/usr/share/minetest
  script:
    - git clone $MINETEST_GAME_REPO AppDir/usr/share/minetest/games/minetest_game
    - rm -rf AppDir/usr/share/minetest/games/minetest/.git
    - export VERSION=$CI_COMMIT_REF_NAME-$CI_COMMIT_SHORT_SHA
    # Remove PrefersNonDefaultGPU property due to validation errors
    - sed -i '/PrefersNonDefaultGPU/d' AppDir/usr/share/applications/net.minetest.minetest.desktop
    - appimage-builder --skip-test
  artifacts:
    expire_in: 90 day
    paths:
      - ./*.AppImage