github.com/nhannv/mattermost-server@v5.11.1+incompatible/build/release.mk (about) 1 2 dist: | check-style test package 3 4 build-linux: 5 @echo Build Linux amd64 6 env GOOS=linux GOARCH=amd64 $(GO) install -i $(GOFLAGS) $(GO_LINKER_FLAGS) ./... 7 8 build-osx: 9 @echo Build OSX amd64 10 env GOOS=darwin GOARCH=amd64 $(GO) install -i $(GOFLAGS) $(GO_LINKER_FLAGS) ./... 11 12 build-windows: 13 @echo Build Windows amd64 14 env GOOS=windows GOARCH=amd64 $(GO) install -i $(GOFLAGS) $(GO_LINKER_FLAGS) ./... 15 16 build: build-linux build-windows build-osx 17 18 build-client: 19 @echo Building mattermost web app 20 21 cd $(BUILD_WEBAPP_DIR) && $(MAKE) build 22 23 package: 24 @ echo Packaging mattermost 25 26 @# Remove any old files 27 rm -Rf $(DIST_ROOT) 28 29 @# Create needed directories 30 mkdir -p $(DIST_PATH)/bin 31 mkdir -p $(DIST_PATH)/logs 32 mkdir -p $(DIST_PATH)/prepackaged_plugins 33 34 @# Resource directories 35 mkdir -p $(DIST_PATH)/config 36 cp -L config/README.md $(DIST_PATH)/config 37 cp -L config/config.json $(DIST_PATH)/config 38 cp -RL fonts $(DIST_PATH) 39 cp -RL templates $(DIST_PATH) 40 cp -RL i18n $(DIST_PATH) 41 42 @# Disable developer settings 43 sed -i'' -e 's|"ConsoleLevel": "DEBUG"|"ConsoleLevel": "INFO"|g' $(DIST_PATH)/config/config.json 44 sed -i'' -e 's|"SiteURL": "http://localhost:8065"|"SiteURL": ""|g' $(DIST_PATH)/config/config.json 45 46 @# Reset email sending to original configuration 47 sed -i'' -e 's|"SendEmailNotifications": true,|"SendEmailNotifications": false,|g' $(DIST_PATH)/config/config.json 48 sed -i'' -e 's|"FeedbackEmail": "test@example.com",|"FeedbackEmail": "",|g' $(DIST_PATH)/config/config.json 49 sed -i'' -e 's|"ReplyToAddress": "test@example.com",|"ReplyToAddress": "",|g' $(DIST_PATH)/config/config.json 50 sed -i'' -e 's|"SMTPServer": "dockerhost",|"SMTPServer": "",|g' $(DIST_PATH)/config/config.json 51 sed -i'' -e 's|"SMTPPort": "2500",|"SMTPPort": "",|g' $(DIST_PATH)/config/config.json 52 53 @# Package webapp 54 mkdir -p $(DIST_PATH)/client 55 cp -RL $(BUILD_WEBAPP_DIR)/dist/* $(DIST_PATH)/client 56 57 @# Help files 58 ifeq ($(BUILD_ENTERPRISE_READY),true) 59 cp $(BUILD_ENTERPRISE_DIR)/ENTERPRISE-EDITION-LICENSE.txt $(DIST_PATH) 60 else 61 cp build/MIT-COMPILED-LICENSE.md $(DIST_PATH) 62 endif 63 cp NOTICE.txt $(DIST_PATH) 64 cp README.md $(DIST_PATH) 65 66 @# Download prepackaged plugins 67 @for plugin_package in $(PLUGIN_PACKAGES) ; do \ 68 curl -s https://api.github.com/repos/mattermost/$$plugin_package/releases/latest | grep browser_download_url | cut -d '"' -f 4 | wget -qi - -P $(DIST_PATH)/prepackaged_plugins/ ;\ 69 done 70 71 @# ----- PLATFORM SPECIFIC ----- 72 73 @# Make osx package 74 @# Copy binary 75 ifeq ($(BUILDER_GOOS_GOARCH),"darwin_amd64") 76 cp $(GOPATH)/bin/mattermost $(DIST_PATH)/bin # from native bin dir, not cross-compiled 77 cp $(GOPATH)/bin/platform $(DIST_PATH)/bin # from native bin dir, not cross-compiled 78 else 79 cp $(GOPATH)/bin/darwin_amd64/mattermost $(DIST_PATH)/bin # from cross-compiled bin dir 80 cp $(GOPATH)/bin/darwin_amd64/platform $(DIST_PATH)/bin # from cross-compiled bin dir 81 endif 82 @# Package 83 tar -C dist -czf $(DIST_PATH)-$(BUILD_TYPE_NAME)-osx-amd64.tar.gz mattermost 84 @# Cleanup 85 rm -f $(DIST_PATH)/bin/mattermost 86 rm -f $(DIST_PATH)/bin/platform 87 88 @# Make windows package 89 @# Copy binary 90 ifeq ($(BUILDER_GOOS_GOARCH),"windows_amd64") 91 cp $(GOPATH)/bin/mattermost.exe $(DIST_PATH)/bin # from native bin dir, not cross-compiled 92 cp $(GOPATH)/bin/platform.exe $(DIST_PATH)/bin # from native bin dir, not cross-compiled 93 else 94 cp $(GOPATH)/bin/windows_amd64/mattermost.exe $(DIST_PATH)/bin # from cross-compiled bin dir 95 cp $(GOPATH)/bin/windows_amd64/platform.exe $(DIST_PATH)/bin # from cross-compiled bin dir 96 endif 97 @# Package 98 cd $(DIST_ROOT) && zip -9 -r -q -l mattermost-$(BUILD_TYPE_NAME)-windows-amd64.zip mattermost && cd .. 99 @# Cleanup 100 rm -f $(DIST_PATH)/bin/mattermost.exe 101 rm -f $(DIST_PATH)/bin/platform.exe 102 103 @# Make linux package 104 @# Copy binary 105 ifeq ($(BUILDER_GOOS_GOARCH),"linux_amd64") 106 cp $(GOPATH)/bin/mattermost $(DIST_PATH)/bin # from native bin dir, not cross-compiled 107 cp $(GOPATH)/bin/platform $(DIST_PATH)/bin # from native bin dir, not cross-compiled 108 else 109 cp $(GOPATH)/bin/linux_amd64/mattermost $(DIST_PATH)/bin # from cross-compiled bin dir 110 cp $(GOPATH)/bin/linux_amd64/platform $(DIST_PATH)/bin # from cross-compiled bin dir 111 endif 112 @# Package 113 tar -C dist -czf $(DIST_PATH)-$(BUILD_TYPE_NAME)-linux-amd64.tar.gz mattermost 114 @# Don't clean up native package so dev machines will have an unzipped package available 115 @#rm -f $(DIST_PATH)/bin/mattermost