]> granicus.if.org Git - handbrake/commitdiff
build: Add install, install-strip, and uninstall targets for Darwin/Mac.
authorBradley Sepos <bradley@bradleysepos.com>
Thu, 22 Dec 2016 05:42:42 +0000 (00:42 -0500)
committerBradley Sepos <bradley@bradleysepos.com>
Thu, 22 Dec 2016 07:55:27 +0000 (02:55 -0500)
Also refactor test.* convenience targets for Darwin/Mac.

Configure parameter --prefix now sets HandBrakeCLI install directory [/usr/local] like on other systems.
New configure parameter --xcode-prefix sets HandBrake.app install directory [/Applications]. Not used on other systems.

macosx/module.rules
macosx/module.xcodebuild
make/configure.py
test/module.rules

index 7d4d368fc71788282a9509a6744f20d8bc89080d..20011c03dff6666a9a32efe935f685f3218c0376 100644 (file)
@@ -1,8 +1,36 @@
 $(eval $(call import.MODULE.rules,MACOSX))
 
+build: macosx.build
+install: macosx.install
+uninstall: macosx.uninstall
+clean: macosx.clean
+xclean: macosx.xclean
+
+########################################
+# sync with ../test/module.rules       #
+########################################
+test.install-strip: | $(dir $(TEST.install.exe))
+       $(CP.exe) $(TEST.exe) $(TEST.install.exe)
+       $(STRIP.exe) $(TEST.install.exe)
+
+test.install: | $(dir $(TEST.install.exe))
+       $(CP.exe) $(TEST.exe) $(TEST.install.exe)
+
+test.uninstall:
+       $(RM.exe) -f $(TEST.install.exe)
+
+test.clean:
+       $(RM.exe) -f $(TEST.out)
+
+test.xclean: test.clean
+########################################
+
 macosx.build: $(MACOSX.m4.out)
 macosx.build: $(MACOSX.osl.filelist)
 
+macosx.install: test.install
+macosx.uninstall: test.uninstall
+
 macosx.clean:
        $(RM.exe) -f $(MACOSX.m4.out)
        $(RM.exe) -f $(MACOSX.osl.filelist)
@@ -11,13 +39,6 @@ macosx.xclean:
        $(RM.exe) -rf $(MACOSX.build/)
        $(RM.exe) -rf $(MACOSX.xroot/)
 
-test.clean:
-       $(RM.exe) -f $(MACOSX.xroot/)HandBrakeCLI
-       $(RM.exe) -rf $(MACOSX.xroot/)HandBrakeCLI.dSYM
-       $(RM.exe) -rf $(MACOSX.xroot/)HandBrakeCLI.build
-
-test.xclean: test.clean
-
 $(MACOSX.m4.out): $(BUILD/)project/handbrake.m4
 $(MACOSX.m4.out): | $(dir $(MACOSX.m4.out))
 $(MACOSX.m4.out): $(MACOSX.build/)%: $(MACOSX.src/)%.m4
@@ -28,8 +49,3 @@ $(MACOSX.osl.filelist): $(BUILD/)GNUmakefile
        @echo "creating $@"
        @> $@
        $(foreach i,$(foreach m,$(MODULES.NAMES),$($m.OSL.files)),$(call fn.PRINTLN,@echo $i >> $@))
-
-###############################################################################
-
-clean: macosx.clean
-build: macosx.build
index 26b34a9cbb22cfa0f6129264dd863ea22cf1c331..bb62e80dbaa5fd074523cdfc8f076cc64aaf6801 100644 (file)
@@ -1,6 +1,6 @@
 ## This file is processed only when shunting build through xcodebuild
 
-.PHONY: macosx.build macosx.clean macosx.install
+.PHONY: macosx.build macosx.clean macosx.install macosx.install-strip macosx.uninstall
 
 macosx.build:
        $(call MACOSX.XCODE,HandBrakeCLI HandBrake,build)
@@ -9,11 +9,26 @@ macosx.clean:
        $(call MACOSX.XCODE,HandBrakeCLI HandBrake,clean)
 
 macosx.install:
-       $(call MACOSX.XCODE,HandBrakeCLI HandBrake,install)
+       $(RM.exe) -rf $(XCODE.prefix/)HandBrake.app
+       $(CP.exe) -R $(MACOSX.xroot/)HandBrake.app $(XCODE.prefix/)
+       $(CP.exe) $(MACOSX.xroot/)HandBrakeCLI $(PREFIX/)bin/
+
+macosx.install-strip:
+       $(RM.exe) -rf $(XCODE.prefix/)HandBrake.app
+       $(CP.exe) -R $(MACOSX.xroot/)HandBrake.app $(XCODE.prefix/)
+       $(STRIP.exe) $(XCODE.prefix/)HandBrake.app/Contents/MacOS/HandBrake
+       $(CP.exe) $(MACOSX.xroot/)HandBrakeCLI $(PREFIX/)bin/
+       $(STRIP.exe) $(PREFIX/)bin/HandBrakeCLI
+
+macosx.uninstall:
+       $(RM.exe) -rf $(XCODE.prefix/)HandBrake.app
+       $(RM.exe) -f $(PREFIX/)bin/HandBrakeCLI
 
 build: macosx.build
 clean: macosx.clean
 install: macosx.install
+install-strip: macosx.install-strip
+uninstall: macosx.uninstall
 xclean: clean
 
 ###############################################################################
index cc758330c11dbffbc2c93d5684fc7da62d1036b1..36c782380ea241319dfd50ef2630c115a09a792d 100644 (file)
@@ -99,10 +99,14 @@ class Configure( object ):
         self.build_final  = os.curdir
         self.src_final    = self._final_dir( self.build_dir, self.src_dir )
         self.prefix_final = self._final_dir( self.build_dir, self.prefix_dir )
+        if host.match( '*-*-darwin*' ):
+            self.xcode_prefix_final = self._final_dir( self.build_dir, self.xcode_prefix_dir )
 
         self.infof( 'compute: makevar SRC/    = %s\n', self.src_final )
         self.infof( 'compute: makevar BUILD/  = %s\n', self.build_final )
         self.infof( 'compute: makevar PREFIX/ = %s\n', self.prefix_final )
+        if host.match( '*-*-darwin*' ):
+            self.infof( 'compute: makevar XCODE.prefix/ = %s\n', self.xcode_prefix_final )
 
     ## perform chdir and enable log recording
     def chdir( self ):
@@ -198,6 +202,8 @@ class Configure( object ):
         self.src_dir    = os.path.normpath( options.src )
         self.build_dir  = os.path.normpath( options.build )
         self.prefix_dir = os.path.normpath( options.prefix )
+        if host.match( '*-*-darwin*' ):
+            self.xcode_prefix_dir = os.path.normpath( options.xcode_prefix )
         if options.sysroot != None:
                 self.sysroot_dir = os.path.normpath( options.sysroot )
         else:
@@ -1356,6 +1362,8 @@ def createCLI():
         grp = OptionGroup( cli, 'Xcode Options' )
         grp.add_option( '--disable-xcode', default=False, action='store_true',
             help='disable Xcode' )
+        grp.add_option( '--xcode-prefix', default=cfg.xcode_prefix_dir, action='store', metavar='DIR',
+            help='specify install dir for Xcode products [%s]' % (cfg.xcode_prefix_dir) )
         grp.add_option( '--xcode-symroot', default='xroot', action='store', metavar='DIR',
             help='specify root of the directory hierarchy that contains product files and intermediate build files' )
         xcconfigMode.cli_add_option( grp, '--xcode-config' )
@@ -1493,7 +1501,9 @@ try:
     cfg   = Configure( verbose )
     host  = HostTupleProbe(); host.run()
 
-    cfg.prefix_dir = ForHost( '/usr/local', ['/Applications','*-*-darwin*'] ).value
+    cfg.prefix_dir = '/usr/local'
+    if host.match( '*-*-darwin*' ):
+        cfg.xcode_prefix_dir = '/Applications'
 
     build = BuildAction()
     arch  = ArchAction(); arch.run()
@@ -1856,6 +1866,8 @@ int main()
 
     if not Tools.xcodebuild.fail and not options.disable_xcode:
         doc.addBlank()
+        doc.add( 'XCODE.prefix',  cfg.xcode_prefix_final )
+        doc.add( 'XCODE.prefix/', cfg.xcode_prefix_final + os.sep )
         doc.add( 'XCODE.driver', options.xcode_driver )
         if os.path.isabs(options.xcode_symroot):
             doc.add( 'XCODE.symroot', options.xcode_symroot )
index 5f41d4d2f1a8715f862768ebf29507130124f25f..5dd638815a28aa8cd40471b0bfcfba9b9eabd6e8 100644 (file)
@@ -1,29 +1,17 @@
 $(eval $(call import.MODULE.rules,TEST))
 
-test.build: $(TEST.exe)
-
-$(TEST.exe): | $(dir $(TEST.exe))
-$(TEST.exe): $(TEST.c.o)
-       $(call TEST.GCC.EXE++,$@,$^ $(TEST.libs))
-
-$(TEST.c.o): $(LIBHB.a)
-$(TEST.c.o): | $(dir $(TEST.c.o))
-$(TEST.c.o): $(BUILD/)%.o: $(SRC/)%.c
-       $(call TEST.GCC.C_O,$@,$<)
-
-test.clean:
-       $(RM.exe) -f $(TEST.out)
-
-###############################################################################
-
 build: test.build
+install: test.install
+install-strip: test.install-strip
+uninstall: test.uninstall
 clean: test.clean
+xclean: test.xclean
 
-###############################################################################
-
-## skip install/uninstall on darwin
-ifneq ($(BUILD.system),darwin)
+test.build: $(TEST.exe)
 
+########################################
+# sync with ../macosx/module.rules     #
+########################################
 test.install-strip: | $(dir $(TEST.install.exe))
        $(CP.exe) $(TEST.exe) $(TEST.install.exe)
        $(STRIP.exe) $(TEST.install.exe)
@@ -34,8 +22,17 @@ test.install: | $(dir $(TEST.install.exe))
 test.uninstall:
        $(RM.exe) -f $(TEST.install.exe)
 
-install-strip: test.install-strip
-install: test.install
-uninstall: test.uninstall
+test.clean:
+       $(RM.exe) -f $(TEST.out)
+
+test.xclean: test.clean
+########################################
 
-endif
+$(TEST.exe): | $(dir $(TEST.exe))
+$(TEST.exe): $(TEST.c.o)
+       $(call TEST.GCC.EXE++,$@,$^ $(TEST.libs))
+
+$(TEST.c.o): $(LIBHB.a)
+$(TEST.c.o): | $(dir $(TEST.c.o))
+$(TEST.c.o): $(BUILD/)%.o: $(SRC/)%.c
+       $(call TEST.GCC.C_O,$@,$<)