You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Makefile 17KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474
  1. DIST := dist
  2. IMPORT := code.gitea.io/gitea
  3. export GO111MODULE=off
  4. GO ?= go
  5. SED_INPLACE := sed -i
  6. SHASUM ?= shasum -a 256
  7. export PATH := $($(GO) env GOPATH)/bin:$(PATH)
  8. ifeq ($(OS), Windows_NT)
  9. EXECUTABLE ?= gitea.exe
  10. else
  11. EXECUTABLE ?= gitea
  12. UNAME_S := $(shell uname -s)
  13. ifeq ($(UNAME_S),Darwin)
  14. SED_INPLACE := sed -i ''
  15. endif
  16. endif
  17. BINDATA := modules/{options,public,templates}/bindata.go
  18. GOFILES := $(shell find . -name "*.go" -type f ! -path "./vendor/*" ! -path "*/bindata.go")
  19. GOFMT ?= gofmt -s
  20. GOFLAGS := -v
  21. EXTRA_GOFLAGS ?=
  22. MAKE_VERSION := $(shell make -v | head -n 1)
  23. ifneq ($(DRONE_TAG),)
  24. VERSION ?= $(subst v,,$(DRONE_TAG))
  25. GITEA_VERSION ?= $(VERSION)
  26. else
  27. ifneq ($(DRONE_BRANCH),)
  28. VERSION ?= $(subst release/v,,$(DRONE_BRANCH))
  29. else
  30. VERSION ?= master
  31. endif
  32. GITEA_VERSION ?= $(shell git describe --tags --always | sed 's/-/+/' | sed 's/^v//')
  33. endif
  34. LDFLAGS := $(LDFLAGS) -X "main.MakeVersion=$(MAKE_VERSION)" -X "main.Version=$(GITEA_VERSION)" -X "main.Tags=$(TAGS)"
  35. PACKAGES ?= $(filter-out code.gitea.io/gitea/integrations/migration-test,$(filter-out code.gitea.io/gitea/integrations,$(shell GO111MODULE=on $(GO) list -mod=vendor ./... | grep -v /vendor/)))
  36. SOURCES ?= $(shell find . -name "*.go" -type f)
  37. TAGS ?=
  38. TMPDIR := $(shell mktemp -d 2>/dev/null || mktemp -d -t 'gitea-temp')
  39. #To update swagger use: GO111MODULE=on go get -u github.com/go-swagger/go-swagger/cmd/swagger@v0.20.1
  40. SWAGGER := GO111MODULE=on $(GO) run -mod=vendor github.com/go-swagger/go-swagger/cmd/swagger
  41. SWAGGER_SPEC := templates/swagger/v1_json.tmpl
  42. SWAGGER_SPEC_S_TMPL := s|"basePath": *"/api/v1"|"basePath": "{{AppSubUrl}}/api/v1"|g
  43. SWAGGER_SPEC_S_JSON := s|"basePath": *"{{AppSubUrl}}/api/v1"|"basePath": "/api/v1"|g
  44. SWAGGER_NEWLINE_COMMAND := -e '$$a\'
  45. TEST_MYSQL_HOST ?= mysql:3306
  46. TEST_MYSQL_DBNAME ?= testgitea
  47. TEST_MYSQL_USERNAME ?= root
  48. TEST_MYSQL_PASSWORD ?=
  49. TEST_MYSQL8_HOST ?= mysql8:3306
  50. TEST_MYSQL8_DBNAME ?= testgitea
  51. TEST_MYSQL8_USERNAME ?= root
  52. TEST_MYSQL8_PASSWORD ?=
  53. TEST_PGSQL_HOST ?= pgsql:5432
  54. TEST_PGSQL_DBNAME ?= testgitea
  55. TEST_PGSQL_USERNAME ?= postgres
  56. TEST_PGSQL_PASSWORD ?= postgres
  57. TEST_MSSQL_HOST ?= mssql:1433
  58. TEST_MSSQL_DBNAME ?= gitea
  59. TEST_MSSQL_USERNAME ?= sa
  60. TEST_MSSQL_PASSWORD ?= MwantsaSecurePassword1
  61. # $(call strip-suffix,filename)
  62. strip-suffix = $(firstword $(subst ., ,$(1)))
  63. .PHONY: all
  64. all: build
  65. include docker/Makefile
  66. .PHONY: clean
  67. clean:
  68. $(GO) clean -i ./...
  69. rm -rf $(EXECUTABLE) $(DIST) $(BINDATA) \
  70. integrations*.test \
  71. integrations/gitea-integration-pgsql/ integrations/gitea-integration-mysql/ integrations/gitea-integration-mysql8/ integrations/gitea-integration-sqlite/ \
  72. integrations/gitea-integration-mssql/ integrations/indexers-mysql/ integrations/indexers-mysql8/ integrations/indexers-pgsql integrations/indexers-sqlite \
  73. integrations/indexers-mssql integrations/mysql.ini integrations/mysql8.ini integrations/pgsql.ini integrations/mssql.ini
  74. .PHONY: fmt
  75. fmt:
  76. $(GOFMT) -w $(GOFILES)
  77. .PHONY: vet
  78. vet:
  79. $(GO) vet $(PACKAGES)
  80. .PHONY: generate
  81. generate:
  82. GO111MODULE=on $(GO) generate -mod=vendor $(PACKAGES)
  83. .PHONY: generate-swagger
  84. generate-swagger:
  85. $(SWAGGER) generate spec -o './$(SWAGGER_SPEC)'
  86. $(SED_INPLACE) '$(SWAGGER_SPEC_S_TMPL)' './$(SWAGGER_SPEC)'
  87. $(SED_INPLACE) $(SWAGGER_NEWLINE_COMMAND) './$(SWAGGER_SPEC)'
  88. .PHONY: swagger-check
  89. swagger-check: generate-swagger
  90. @diff=$$(git diff '$(SWAGGER_SPEC)'); \
  91. if [ -n "$$diff" ]; then \
  92. echo "Please run 'make generate-swagger' and commit the result:"; \
  93. echo "$${diff}"; \
  94. exit 1; \
  95. fi;
  96. .PHONY: swagger-validate
  97. swagger-validate:
  98. $(SED_INPLACE) '$(SWAGGER_SPEC_S_JSON)' './$(SWAGGER_SPEC)'
  99. $(SWAGGER) validate './$(SWAGGER_SPEC)'
  100. $(SED_INPLACE) '$(SWAGGER_SPEC_S_TMPL)' './$(SWAGGER_SPEC)'
  101. .PHONY: errcheck
  102. errcheck:
  103. @hash errcheck > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
  104. $(GO) get -u github.com/kisielk/errcheck; \
  105. fi
  106. errcheck $(PACKAGES)
  107. .PHONY: lint
  108. lint:
  109. @echo 'make lint is depricated. Use "make revive" if you want to use the old lint tool, or "make golangci-lint" to run a complete code check.'
  110. .PHONY: revive
  111. revive:
  112. @hash revive > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
  113. $(GO) get -u github.com/mgechev/revive; \
  114. fi
  115. revive -config .revive.toml -exclude=./vendor/... ./... || exit 1
  116. .PHONY: misspell-check
  117. misspell-check:
  118. @hash misspell > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
  119. $(GO) get -u github.com/client9/misspell/cmd/misspell; \
  120. fi
  121. misspell -error -i unknwon,destory $(GOFILES)
  122. .PHONY: misspell
  123. misspell:
  124. @hash misspell > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
  125. $(GO) get -u github.com/client9/misspell/cmd/misspell; \
  126. fi
  127. misspell -w -i unknwon $(GOFILES)
  128. .PHONY: fmt-check
  129. fmt-check:
  130. # get all go files and run go fmt on them
  131. @diff=$$($(GOFMT) -d $(GOFILES)); \
  132. if [ -n "$$diff" ]; then \
  133. echo "Please run 'make fmt' and commit the result:"; \
  134. echo "$${diff}"; \
  135. exit 1; \
  136. fi;
  137. .PHONY: test
  138. test:
  139. GO111MODULE=on $(GO) test -mod=vendor -tags='sqlite sqlite_unlock_notify' $(PACKAGES)
  140. .PHONY: coverage
  141. coverage:
  142. @hash gocovmerge > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
  143. $(GO) get -u github.com/wadey/gocovmerge; \
  144. fi
  145. gocovmerge integration.coverage.out $(shell find . -type f -name "coverage.out") > coverage.all;\
  146. .PHONY: unit-test-coverage
  147. unit-test-coverage:
  148. $(GO) test -tags='sqlite sqlite_unlock_notify' -cover -coverprofile coverage.out $(PACKAGES) && echo "\n==>\033[32m Ok\033[m\n" || exit 1
  149. .PHONY: vendor
  150. vendor:
  151. GO111MODULE=on $(GO) mod tidy && GO111MODULE=on $(GO) mod vendor
  152. .PHONY: test-vendor
  153. test-vendor: vendor
  154. @diff=$$(git diff vendor/); \
  155. if [ -n "$$diff" ]; then \
  156. echo "Please run 'make vendor' and commit the result:"; \
  157. echo "$${diff}"; \
  158. exit 1; \
  159. fi;
  160. .PHONY: test-sqlite
  161. test-sqlite: integrations.sqlite.test
  162. GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/sqlite.ini ./integrations.sqlite.test
  163. .PHONY: test-sqlite\#%
  164. test-sqlite\#%: integrations.sqlite.test
  165. GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/sqlite.ini ./integrations.sqlite.test -test.run $*
  166. .PHONY: test-sqlite-migration
  167. test-sqlite-migration: migrations.sqlite.test
  168. GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/sqlite.ini ./migrations.sqlite.test
  169. generate-ini:
  170. sed -e 's|{{TEST_MYSQL_HOST}}|${TEST_MYSQL_HOST}|g' \
  171. -e 's|{{TEST_MYSQL_DBNAME}}|${TEST_MYSQL_DBNAME}|g' \
  172. -e 's|{{TEST_MYSQL_USERNAME}}|${TEST_MYSQL_USERNAME}|g' \
  173. -e 's|{{TEST_MYSQL_PASSWORD}}|${TEST_MYSQL_PASSWORD}|g' \
  174. integrations/mysql.ini.tmpl > integrations/mysql.ini
  175. sed -e 's|{{TEST_MYSQL8_HOST}}|${TEST_MYSQL8_HOST}|g' \
  176. -e 's|{{TEST_MYSQL8_DBNAME}}|${TEST_MYSQL8_DBNAME}|g' \
  177. -e 's|{{TEST_MYSQL8_USERNAME}}|${TEST_MYSQL8_USERNAME}|g' \
  178. -e 's|{{TEST_MYSQL8_PASSWORD}}|${TEST_MYSQL8_PASSWORD}|g' \
  179. integrations/mysql8.ini.tmpl > integrations/mysql8.ini
  180. sed -e 's|{{TEST_PGSQL_HOST}}|${TEST_PGSQL_HOST}|g' \
  181. -e 's|{{TEST_PGSQL_DBNAME}}|${TEST_PGSQL_DBNAME}|g' \
  182. -e 's|{{TEST_PGSQL_USERNAME}}|${TEST_PGSQL_USERNAME}|g' \
  183. -e 's|{{TEST_PGSQL_PASSWORD}}|${TEST_PGSQL_PASSWORD}|g' \
  184. integrations/pgsql.ini.tmpl > integrations/pgsql.ini
  185. sed -e 's|{{TEST_MSSQL_HOST}}|${TEST_MSSQL_HOST}|g' \
  186. -e 's|{{TEST_MSSQL_DBNAME}}|${TEST_MSSQL_DBNAME}|g' \
  187. -e 's|{{TEST_MSSQL_USERNAME}}|${TEST_MSSQL_USERNAME}|g' \
  188. -e 's|{{TEST_MSSQL_PASSWORD}}|${TEST_MSSQL_PASSWORD}|g' \
  189. integrations/mssql.ini.tmpl > integrations/mssql.ini
  190. .PHONY: test-mysql
  191. test-mysql: integrations.test generate-ini
  192. GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/mysql.ini ./integrations.test
  193. .PHONY: test-mysql-migration
  194. test-mysql-migration: migrations.test generate-ini
  195. GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/mysql.ini ./migrations.test
  196. .PHONY: test-mysql8
  197. test-mysql8: integrations.test generate-ini
  198. GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/mysql8.ini ./integrations.test
  199. .PHONY: test-mysql8-migration
  200. test-mysql8-migration: migrations.test generate-ini
  201. GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/mysql8.ini ./migrations.test
  202. .PHONY: test-pgsql
  203. test-pgsql: integrations.test generate-ini
  204. GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/pgsql.ini ./integrations.test
  205. .PHONY: test-pgsql-migration
  206. test-pgsql-migration: migrations.test generate-ini
  207. GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/pgsql.ini ./migrations.test
  208. .PHONY: test-mssql
  209. test-mssql: integrations.test generate-ini
  210. GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/mssql.ini ./integrations.test
  211. .PHONY: test-mssql-migration
  212. test-mssql-migration: migrations.test generate-ini
  213. GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/mssql.ini ./migrations.test
  214. .PHONY: bench-sqlite
  215. bench-sqlite: integrations.sqlite.test
  216. GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/sqlite.ini ./integrations.sqlite.test -test.cpuprofile=cpu.out -test.run DontRunTests -test.bench .
  217. .PHONY: bench-mysql
  218. bench-mysql: integrations.test generate-ini
  219. GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/mysql.ini ./integrations.test -test.cpuprofile=cpu.out -test.run DontRunTests -test.bench .
  220. .PHONY: bench-mssql
  221. bench-mssql: integrations.test generate-ini
  222. GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/mssql.ini ./integrations.test -test.cpuprofile=cpu.out -test.run DontRunTests -test.bench .
  223. .PHONY: bench-pgsql
  224. bench-pgsql: integrations.test generate-ini
  225. GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/pgsql.ini ./integrations.test -test.cpuprofile=cpu.out -test.run DontRunTests -test.bench .
  226. .PHONY: integration-test-coverage
  227. integration-test-coverage: integrations.cover.test generate-ini
  228. GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/mysql.ini ./integrations.cover.test -test.coverprofile=integration.coverage.out
  229. integrations.test: $(SOURCES)
  230. GO111MODULE=on $(GO) test -mod=vendor -c code.gitea.io/gitea/integrations -o integrations.test
  231. integrations.sqlite.test: $(SOURCES)
  232. GO111MODULE=on $(GO) test -mod=vendor -c code.gitea.io/gitea/integrations -o integrations.sqlite.test -tags 'sqlite sqlite_unlock_notify'
  233. integrations.cover.test: $(SOURCES)
  234. GO111MODULE=on $(GO) test -mod=vendor -c code.gitea.io/gitea/integrations -coverpkg $(shell echo $(PACKAGES) | tr ' ' ',') -o integrations.cover.test
  235. .PHONY: migrations.test
  236. migrations.test: $(SOURCES)
  237. $(GO) test -c code.gitea.io/gitea/integrations/migration-test -o migrations.test
  238. .PHONY: migrations.sqlite.test
  239. migrations.sqlite.test: $(SOURCES)
  240. $(GO) test -c code.gitea.io/gitea/integrations/migration-test -o migrations.sqlite.test -tags 'sqlite sqlite_unlock_notify'
  241. .PHONY: check
  242. check: test
  243. .PHONY: install
  244. install: $(wildcard *.go)
  245. $(GO) install -v -tags '$(TAGS)' -ldflags '-s -w $(LDFLAGS)'
  246. .PHONY: build
  247. build: $(EXECUTABLE)
  248. $(EXECUTABLE): $(SOURCES)
  249. GO111MODULE=on $(GO) build -mod=vendor $(GOFLAGS) $(EXTRA_GOFLAGS) -tags '$(TAGS)' -ldflags '-s -w $(LDFLAGS)' -o $@
  250. .PHONY: release
  251. release: release-dirs release-windows release-linux release-darwin release-copy release-compress release-check
  252. .PHONY: release-dirs
  253. release-dirs:
  254. mkdir -p $(DIST)/binaries $(DIST)/release
  255. .PHONY: release-windows
  256. release-windows:
  257. @hash xgo > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
  258. $(GO) get -u src.techknowlogick.com/xgo; \
  259. fi
  260. xgo -dest $(DIST)/binaries -tags 'netgo osusergo $(TAGS)' -ldflags '-linkmode external -extldflags "-static" $(LDFLAGS)' -targets 'windows/*' -out gitea-$(VERSION) .
  261. ifeq ($(CI),drone)
  262. cp /build/* $(DIST)/binaries
  263. endif
  264. .PHONY: release-linux
  265. release-linux:
  266. @hash xgo > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
  267. $(GO) get -u src.techknowlogick.com/xgo; \
  268. fi
  269. xgo -dest $(DIST)/binaries -tags 'netgo osusergo $(TAGS)' -ldflags '-linkmode external -extldflags "-static" $(LDFLAGS)' -targets 'linux/amd64,linux/386,linux/arm-5,linux/arm-6,linux/arm64,linux/mips64le,linux/mips,linux/mipsle' -out gitea-$(VERSION) .
  270. ifeq ($(CI),drone)
  271. cp /build/* $(DIST)/binaries
  272. endif
  273. .PHONY: release-darwin
  274. release-darwin:
  275. @hash xgo > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
  276. $(GO) get -u src.techknowlogick.com/xgo; \
  277. fi
  278. xgo -dest $(DIST)/binaries -tags 'netgo osusergo $(TAGS)' -ldflags '$(LDFLAGS)' -targets 'darwin/*' -out gitea-$(VERSION) .
  279. ifeq ($(CI),drone)
  280. cp /build/* $(DIST)/binaries
  281. endif
  282. .PHONY: release-copy
  283. release-copy:
  284. cd $(DIST); for file in `find /build -type f -name "*"`; do cp $${file} ./release/; done;
  285. .PHONY: release-check
  286. release-check:
  287. cd $(DIST)/release/; for file in `find . -type f -name "*"`; do echo "checksumming $${file}" && $(SHASUM) `echo $${file} | sed 's/^..//'` > $${file}.sha256; done;
  288. .PHONY: release-compress
  289. release-compress:
  290. @hash gxz > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
  291. $(GO) get -u github.com/ulikunitz/xz/cmd/gxz; \
  292. fi
  293. cd $(DIST)/release/; for file in `find . -type f -name "*"`; do echo "compressing $${file}" && gxz -k -9 $${file}; done;
  294. npm-check:
  295. @hash npm > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
  296. echo "Please install Node.js 8.x or greater with npm"; \
  297. exit 1; \
  298. fi;
  299. @hash npx > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
  300. echo "Please install Node.js 8.x or greater with npm"; \
  301. exit 1; \
  302. fi;
  303. .PHONY: npm
  304. npm: npm-check
  305. npm install --no-save
  306. .PHONY: npm-update
  307. npm-update: npm-check
  308. npx updates -cu
  309. rm -rf node_modules package-lock.json
  310. npm install --package-lock
  311. .PHONY: js
  312. js: npm
  313. npx eslint public/js
  314. .PHONY: css
  315. css: npm
  316. npx stylelint public/less
  317. npx lessc --clean-css="--s0 -b" public/less/index.less public/css/index.css
  318. $(foreach file, $(filter-out public/less/themes/_base.less, $(wildcard public/less/themes/*)),npx lessc --clean-css="--s0 -b" public/less/themes/$(notdir $(file)) > public/css/theme-$(notdir $(call strip-suffix,$(file))).css;)
  319. npx postcss --use autoprefixer --no-map --replace public/css/*
  320. @diff=$$(git diff public/css/*); \
  321. if ([ -n "$$CI" ] && [ -n "$$diff" ]); then \
  322. echo "Generated files in public/css have changed, please commit the result:"; \
  323. echo "$${diff}"; \
  324. exit 1; \
  325. fi;
  326. .PHONY: javascripts
  327. javascripts:
  328. echo "'make javascripts' is deprecated, please use 'make js'"
  329. $(MAKE) js
  330. .PHONY: stylesheets-check
  331. stylesheets-check:
  332. echo "'make stylesheets-check' is deprecated, please use 'make css'"
  333. $(MAKE) css
  334. .PHONY: generate-stylesheets
  335. generate-stylesheets:
  336. echo "'make generate-stylesheets' is deprecated, please use 'make css'"
  337. $(MAKE) css
  338. .PHONY: swagger-ui
  339. swagger-ui:
  340. rm -Rf public/vendor/assets/swagger-ui
  341. git clone --depth=10 -b v3.13.4 --single-branch https://github.com/swagger-api/swagger-ui.git $(TMPDIR)/swagger-ui
  342. mv $(TMPDIR)/swagger-ui/dist public/vendor/assets/swagger-ui
  343. rm -Rf $(TMPDIR)/swagger-ui
  344. $(SED_INPLACE) "s;http://petstore.swagger.io/v2/swagger.json;../../../swagger.v1.json;g" public/vendor/assets/swagger-ui/index.html
  345. .PHONY: update-translations
  346. update-translations:
  347. mkdir -p ./translations
  348. cd ./translations && curl -L https://crowdin.com/download/project/gitea.zip > gitea.zip && unzip gitea.zip
  349. rm ./translations/gitea.zip
  350. $(SED_INPLACE) -e 's/="/=/g' -e 's/"$$//g' ./translations/*.ini
  351. $(SED_INPLACE) -e 's/\\"/"/g' ./translations/*.ini
  352. mv ./translations/*.ini ./options/locale/
  353. rmdir ./translations
  354. .PHONY: generate-images
  355. generate-images:
  356. mkdir -p $(TMPDIR)/images
  357. inkscape -f $(PWD)/assets/logo.svg -w 880 -h 880 -e $(PWD)/public/img/gitea-lg.png
  358. inkscape -f $(PWD)/assets/logo.svg -w 512 -h 512 -e $(PWD)/public/img/gitea-512.png
  359. inkscape -f $(PWD)/assets/logo.svg -w 192 -h 192 -e $(PWD)/public/img/gitea-192.png
  360. inkscape -f $(PWD)/assets/logo.svg -w 120 -h 120 -jC -i layer1 -e $(TMPDIR)/images/sm-1.png
  361. inkscape -f $(PWD)/assets/logo.svg -w 120 -h 120 -jC -i layer2 -e $(TMPDIR)/images/sm-2.png
  362. composite -compose atop $(TMPDIR)/images/sm-2.png $(TMPDIR)/images/sm-1.png $(PWD)/public/img/gitea-sm.png
  363. inkscape -f $(PWD)/assets/logo.svg -w 200 -h 200 -e $(PWD)/public/img/avatar_default.png
  364. inkscape -f $(PWD)/assets/logo.svg -w 180 -h 180 -e $(PWD)/public/img/favicon.png
  365. inkscape -f $(PWD)/assets/logo.svg -w 128 -h 128 -e $(TMPDIR)/images/128-raw.png
  366. inkscape -f $(PWD)/assets/logo.svg -w 64 -h 64 -e $(TMPDIR)/images/64-raw.png
  367. inkscape -f $(PWD)/assets/logo.svg -w 32 -h 32 -jC -i layer1 -e $(TMPDIR)/images/32-1.png
  368. inkscape -f $(PWD)/assets/logo.svg -w 32 -h 32 -jC -i layer2 -e $(TMPDIR)/images/32-2.png
  369. composite -compose atop $(TMPDIR)/images/32-2.png $(TMPDIR)/images/32-1.png $(TMPDIR)/images/32-raw.png
  370. inkscape -f $(PWD)/assets/logo.svg -w 16 -h 16 -jC -i layer1 -e $(TMPDIR)/images/16-raw.png
  371. zopflipng -m -y $(TMPDIR)/images/128-raw.png $(TMPDIR)/images/128.png
  372. zopflipng -m -y $(TMPDIR)/images/64-raw.png $(TMPDIR)/images/64.png
  373. zopflipng -m -y $(TMPDIR)/images/32-raw.png $(TMPDIR)/images/32.png
  374. zopflipng -m -y $(TMPDIR)/images/16-raw.png $(TMPDIR)/images/16.png
  375. rm -f $(TMPDIR)/images/*-*.png
  376. convert $(TMPDIR)/images/16.png $(TMPDIR)/images/32.png \
  377. $(TMPDIR)/images/64.png $(TMPDIR)/images/128.png \
  378. $(PWD)/public/img/favicon.ico
  379. rm -rf $(TMPDIR)/images
  380. $(foreach file, $(shell find public/img -type f -name '*.png'),zopflipng -m -y $(file) $(file);)
  381. .PHONY: pr
  382. pr:
  383. $(GO) run contrib/pr/checkout.go $(PR)
  384. .PHONY: golangci-lint
  385. golangci-lint:
  386. @hash golangci-lint > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
  387. export BINARY="golangci-lint"; \
  388. curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(GOPATH)/bin v1.18.0; \
  389. fi
  390. golangci-lint run --deadline=3m