github.com/turgay/mattermost-server@v5.3.2-0.20181002173352-2945e8a2b0ce+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  	cp -RL config $(DIST_PATH)
    36  	cp -RL fonts $(DIST_PATH)
    37  	cp -RL templates $(DIST_PATH)
    38  	cp -RL i18n $(DIST_PATH)
    39  
    40  	@# Disable developer settings
    41  	sed -i'' -e 's|"ConsoleLevel": "DEBUG"|"ConsoleLevel": "INFO"|g' $(DIST_PATH)/config/config.json
    42  	sed -i'' -e 's|"SiteURL": "http://localhost:8065"|"SiteURL": ""|g' $(DIST_PATH)/config/config.json
    43  
    44  	@# Reset email sending to original configuration
    45  	sed -i'' -e 's|"SendEmailNotifications": true,|"SendEmailNotifications": false,|g' $(DIST_PATH)/config/config.json
    46  	sed -i'' -e 's|"FeedbackEmail": "test@example.com",|"FeedbackEmail": "",|g' $(DIST_PATH)/config/config.json
    47  	sed -i'' -e 's|"SMTPServer": "dockerhost",|"SMTPServer": "",|g' $(DIST_PATH)/config/config.json
    48  	sed -i'' -e 's|"SMTPPort": "2500",|"SMTPPort": "",|g' $(DIST_PATH)/config/config.json
    49  
    50  	@# Package webapp
    51  	mkdir -p $(DIST_PATH)/client
    52  	cp -RL $(BUILD_WEBAPP_DIR)/dist/* $(DIST_PATH)/client
    53  
    54  	@# Help files
    55  ifeq ($(BUILD_ENTERPRISE_READY),true)
    56  	cp $(BUILD_ENTERPRISE_DIR)/ENTERPRISE-EDITION-LICENSE.txt $(DIST_PATH)
    57  else
    58  	cp build/MIT-COMPILED-LICENSE.md $(DIST_PATH)
    59  endif
    60  	cp NOTICE.txt $(DIST_PATH)
    61  	cp README.md $(DIST_PATH)
    62  
    63  	@# ----- PLATFORM SPECIFIC -----
    64  
    65  	@# Make osx package
    66  	@# Copy binary
    67  ifeq ($(BUILDER_GOOS_GOARCH),"darwin_amd64")
    68  	cp $(GOPATH)/bin/mattermost $(DIST_PATH)/bin # from native bin dir, not cross-compiled
    69  	cp $(GOPATH)/bin/platform $(DIST_PATH)/bin # from native bin dir, not cross-compiled
    70  	@for plugin_package in $(PLUGIN_PACKAGES) ; do \
    71      curl -s https://api.github.com/repos/mattermost/$$plugin_package/releases/latest | grep browser_download_url | grep darwin | cut -d '"' -f 4 | wget -qi - -P  $(DIST_PATH)/prepackaged_plugins/ ;\
    72  	done
    73  else
    74  	cp $(GOPATH)/bin/darwin_amd64/mattermost $(DIST_PATH)/bin # from cross-compiled bin dir
    75  	cp $(GOPATH)/bin/darwin_amd64/platform $(DIST_PATH)/bin # from cross-compiled bin dir
    76  	@for plugin_package in $(PLUGIN_PACKAGES) ; do \
    77      curl -s https://api.github.com/repos/mattermost/$$plugin_package/releases/latest | grep browser_download_url | grep darwin | cut -d '"' -f 4 | wget -qi - -P  $(DIST_PATH)/prepackaged_plugins/ ;\
    78  	done
    79  endif
    80  	@# Package
    81  	tar -C dist -czf $(DIST_PATH)-$(BUILD_TYPE_NAME)-osx-amd64.tar.gz mattermost
    82  	@# Cleanup
    83  	rm -f $(DIST_PATH)/bin/mattermost
    84  	rm -f $(DIST_PATH)/bin/platform
    85  	rm -f $(DIST_PATH)/prepackaged_plugins/*
    86  
    87  	@# Make windows package
    88  	@# Copy binary
    89  ifeq ($(BUILDER_GOOS_GOARCH),"windows_amd64")
    90  	cp $(GOPATH)/bin/mattermost.exe $(DIST_PATH)/bin # from native bin dir, not cross-compiled
    91  	cp $(GOPATH)/bin/platform.exe $(DIST_PATH)/bin # from native bin dir, not cross-compiled
    92  	@for plugin_package in $(PLUGIN_PACKAGES) ; do \
    93      curl -s https://api.github.com/repos/mattermost/$$plugin_package/releases/latest | grep browser_download_url | grep windows | cut -d '"' -f 4 | wget -qi - -P $(DIST_PATH)/prepackaged_plugins/ ;\
    94  	done
    95  else
    96  	cp $(GOPATH)/bin/windows_amd64/mattermost.exe $(DIST_PATH)/bin # from cross-compiled bin dir
    97  	cp $(GOPATH)/bin/windows_amd64/platform.exe $(DIST_PATH)/bin # from cross-compiled bin dir
    98  	@for plugin_package in $(PLUGIN_PACKAGES) ; do \
    99      curl -s https://api.github.com/repos/mattermost/$$plugin_package/releases/latest | grep browser_download_url | grep windows | cut -d '"' -f 4 | wget -qi - -P  $(DIST_PATH)/prepackaged_plugins/ ;\
   100  	done
   101  
   102  endif
   103  	@# Package
   104  	cd $(DIST_ROOT) && zip -9 -r -q -l mattermost-$(BUILD_TYPE_NAME)-windows-amd64.zip mattermost && cd ..
   105  	@# Cleanup
   106  	rm -f $(DIST_PATH)/bin/mattermost.exe
   107  	rm -f $(DIST_PATH)/bin/platform.exe
   108  	rm -f $(DIST_PATH)/prepackaged_plugins/*
   109  
   110  	@# Make linux package
   111  	@# Copy binary
   112  ifeq ($(BUILDER_GOOS_GOARCH),"linux_amd64")
   113  	cp $(GOPATH)/bin/mattermost $(DIST_PATH)/bin # from native bin dir, not cross-compiled
   114  	cp $(GOPATH)/bin/platform $(DIST_PATH)/bin # from native bin dir, not cross-compiled
   115  	@for plugin_package in $(PLUGIN_PACKAGES) ; do \
   116      curl -s https://api.github.com/repos/mattermost/$$plugin_package/releases/latest | grep browser_download_url | grep linux | cut -d '"' -f 4 | wget -qi - -P  $(DIST_PATH)/prepackaged_plugins/ ;\
   117  	done
   118  else
   119  	cp $(GOPATH)/bin/linux_amd64/mattermost $(DIST_PATH)/bin # from cross-compiled bin dir
   120  	cp $(GOPATH)/bin/linux_amd64/platform $(DIST_PATH)/bin # from cross-compiled bin dir
   121  	@for plugin_package in $(PLUGIN_PACKAGES) ; do \
   122      curl -s https://api.github.com/repos/mattermost/$$plugin_package/releases/latest | grep browser_download_url | grep linux | cut -d '"' -f 4 | wget -qi - -P  $(DIST_PATH)/prepackaged_plugins/ ;\
   123  	done
   124  endif
   125  	@# Package
   126  	tar -C dist -czf $(DIST_PATH)-$(BUILD_TYPE_NAME)-linux-amd64.tar.gz mattermost
   127  	@# Don't clean up native package so dev machines will have an unzipped package available
   128  	@#rm -f $(DIST_PATH)/bin/mattermost